nginx指定配置文件
关闭nginx
service nginx stop
设置一个配置文件 order.conf
server { listen 80 default_server; listen 443 default_server; server_name www.xxx.cn; location /static { alias /home/ubuntu/data/www/food_order/web/static/; } location / { try_files $uri @yourapplication; } location @yourapplication { include uwsgi_params; uwsgi_pass unix:/home/ubuntu/data/www/logs/order.sock; uwsgi_read_timeout 1800; uwsgi_send_timeout 300; } }
包含该配置文件
修改/etc/nginx下nginx.conf #include /etc/nginx/conf.d/*.conf; include /etc/nginx/order.conf;
重启nginx
service nginx start|restart
查看状态
[root@VM_0_14_centos nginx]# systemctl status nginx ● nginx.service - nginx - high performance web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2020-03-26 02:09:28 CST; 17min ago Docs: http://nginx.org/en/docs/ Process: 7516 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 7517 (nginx) CGroup: /system.slice/nginx.service ├─7517 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf └─7518 nginx: worker process
nginx的权限问题(13: Permission denied)解决办法
修改nginx.conf
找到
user nobody 改成:user root 停止nginx -s stop 重启nginx -c nginx.conf
设置ssl安全证书
首先在腾讯云上申请证书
证书申请成功后,下载到服务器上
编辑order.conf增加ssl配置
listen 443 ssl; server_name xx.com.cn; ssl on; #证书文件名称 ssl_certificate xx.cn_bundle.crt; #私钥文件名称 ssl_certificate_key xx.cn.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on;
重启nginx
service nginx reload
在浏览器上输入https://xxx.com.cn 查看是否有绿色标识
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步