我是靠谱客的博主 如意金针菇,这篇文章主要介绍nginx配置(https,负载均衡,80重定向443)重新载入配置文件重启 Nginx停止 Nginx,现在分享给大家,希望可以做个参考。

nginx配置(https,负载均衡,80重定向443)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#user nobody; worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { #使用epoll模式提高性能 use epoll; worker_connections 65535; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #提供负载均衡。 RR(默认)每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除。 upstream health-app { server 192.168.0.1:8080; server 192.168.0.2:8080; } server { #nginx 80端口重定向到443端口 listen 80; server_name xx.xx.com; rewrite ^(.*)$ https://${server_name}$1 permanent; #charset koi8-r; #access_log logs/host.access.log main; # 所有静态请求都由nginx处理,存放目录为html #location / { # root html; # index index.html index.htm; # } # 所有动态请求都转发给tomcat处理 #location /health-app/ { # proxy_pass http://health-app; # proxy_set_header Host $host:$server_port; #} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } # HTTPS server # server { listen 443 ssl; server_name xx.xx.com; ssl_certificate /usr/local/webserver/nginx/conf/cert2.pem; ssl_certificate_key /usr/local/webserver/nginx/conf/cert.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } location /health-app/ { proxy_pass http://health-app; proxy_set_header Host $host:$server_port; } } }

常用命令:

重新载入配置文件

/usr/local/webserver/nginx/sbin/nginx -s reload

重启 Nginx

/usr/local/webserver/nginx/sbin/nginx -s reopen

停止 Nginx

/usr/local/webserver/nginx/sbin/nginx -s stop

最后

以上就是如意金针菇最近收集整理的关于nginx配置(https,负载均衡,80重定向443)重新载入配置文件重启 Nginx停止 Nginx的全部内容,更多相关nginx配置(https,负载均衡,80重定向443)重新载入配置文件重启内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(83)

评论列表共有 0 条评论

立即
投稿
返回
顶部