windows下nginx1.18安装后,在conf里打开nginx.conf在最下方找到以下注释,#HTTPS server以下的注释都打开
HTTPS server
#HTTPS server server { listen 443 ssl; server_name www.123.com; ssl_certificate E:/nginx-1.20.1/www.123.com.pem; ssl_certificate_key E:/nginx-1.20.1/www.123.com-key.pem; 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 / { root dist; index index.html index.htm; } location ~/(api/|upload/file/|druid/){ proxy_pass http://www.123.com:8103; } }
1111111111111111111111111111111
server_name www.123.com这个配置首先在HOSTS里改
(c:\Windows\System32\drivers\etc)
打一行127.0.0.1 www.123.com
22222222222222222222222222222222
ssl_certificate E:/nginx-1.20.1/www.123.com.pem; ssl_certificate_key E:/nginx-1.20.1/www.123.com-key.pem;
证书用的这个:mkcert下载链接
下载后解压缩打开 https本地证书生成工具.bat 按提示生成
333333333333333333333333333333333
vue前后端分离模式部署
dist中放VUE生成的HTML/CSS/JS
其它不要动,先启后台再启NGINX即可访问!