环境是都是军哥lnmp
这个配置是我在/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 http://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 http://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;
- }
复制代码
辽宁网友:虽然开机nginx会不启动,但是手动restart下就好了,好奇怪
- [email protected]:~# lnmp restart
- +——————————————-+
- | Manager for LNMP, Written by Licess |
- +——————————————-+
- | https://lnmp.org |
- +——————————————-+
- Stoping LNMP…
- Stoping nginx… nginx is not running.
- [ ok ] Stopping mysql (via systemctl): mysql.service.
- Gracefully shutting down php-fpm done
- Starting LNMP…
- Starting nginx… done
- [ ok ] Starting mysql (via systemctl): mysql.service.
- Starting php-fpm done
复制代码
甘肃网友:求助dalao
实在不行就换成centos7了,主要重装一次好麻烦
澳门网友:内存不够了吧,看看是不是吃到swap了。。。
台湾网友:重启后内存free还有300多啊
swap倒是用了十几M
山东网友:额,换成成CENTOS7,没有这个问题了
环境还是my5.5 php7.2 nginx,之前还寻思用大便9省点资源,看来反而耽误了
以上信息转载自Hostloc。