nginx配置问题

HTML  2023-06-16 14:02  250  
proxy_pass https://news.shopify.com;

提示:

nginx[28410]: nginx: [emerg] host not found in upstream "news.shopify.com" in /etc/nginx/conf.d/tzj.conf:27

后面改成这样可以,不知道原因。

set $pass_url news.shopify.com;
proxy_pass https://$pass_url;


另外遇到一个登录root账户使用acme.sh颁发证书后,nginx无法读取证书文件的问题:

nginx: [emerg] cannot load certificate "/etc/nginx/cert/vms.20210502.xyz_ecc/fullchain.cer": BIO_new_file() failed (SSL: error:02001...:system lib)


尝试关闭selinux可以正常启动,在网上找到这样的说明

If your chmod and chown is all correct on the file, this is probably because you copied a file into a folder - maybe home folder (say) - then mv'd the file into position for NGINX. SeLinux remembers the original file creation location and applies the rights wherever the file is mv'd to - to reset the SeLinux permissions to the current location/file permissions use 

restorecon filename

确实如他所说,证书是从/root/.acme.sh/domain.xxx/下复制过来的,后面将selinux打开,对两个证书文件执行 restorecon filename 命令可以正常启动nginx


引用:https://stackoverflow.com/a/66257354/12484653



发布于 2023-06-16 14:02, 最后修改于2023-06-16 14:02