这个反代配置那里有问题吗,为什么会导致nginx不能开机自启
这个配置是我在/usr/local/nginx/conf/example里面看到的,我只修改了server_name和proxy_pass部分之前在一台1G1C的centos7小鸡上测试是没问题,VPS重启后访问下载都可以
今天在一台512m的debian9小鸡上配置好,VPS重启后nginx总是无法启动,必须手动启动下才可以
但是如果删掉443模块的所有proxy相关内容,重启后nginx就可以启动了
话说这是那里问题呢?小鸡配置不够,还是debian9问题,还是我反代配置那里没写好?:(
server {
listen 80;
#listen [::]:80;
server_name example.com www.example.com;
#如果需要http 301跳转到 https 需要将下面行前面的 # 注释去掉,并重载nginx
#return 301 https://$host$request_uri;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto$scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
access_log off;
}
server {
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name example.com www.example.com;
ssl_certificate /usr/local/nginx/conf/ssl/example.com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/example.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto$scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
access_log off;
}
配置文件上看是没问题的,不好确定什么原因 licess 发表于 2019-7-5 08:34
配置文件上看是没问题的,不好确定什么原因
今天换centos7正常了
之前debian9试了两次重新部署环境都不行
页:
[1]