求大神帮忙配置Nginx,由于微信小程序请求WebSocket不能带端口号,需要在Nginx上做一个域名转发(代理)
WorderMan端口是8282,主域名用的是80端口,主域名已开启了https
Nginx配置文件内容如下:
server {
listen 80;
root /www/web/lsb_abc_net/public_html/public;
server_name lsb.abc.net lsb.abc.net;
rewrite ^(.*)$ https://$host$1 permanent;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ .php$ {
proxy_pass http://127.0.0.1:8282;
include naproxy.conf;
}
location ~ /.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
}
server {
listen 443;
root /www/web/lsb_abc_net/public_html/public;
ssl on;
ssl_certificate cert/lsb.abc.net.pem;
ssl_certificate_key cert/lsb.abc.net.key;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
server_name lsb.abc.net;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ .php$ {
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
location ~ /.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
}