1、打开域名解析,设置指向ngnix服务器
主机记录填子域名,记录值填ngnix服务器ip
2、打开宝塔面板,没有在下面网址下载安装
https://www.bt.cn
软件管理,找到ngnix,配置,增加如下内容
upstream xxxx.xxxx.com { #ip_hash; server xx.xx.xx.xxx:7000; }
server { listen 80;#default_server; #端口 listen 443 ssl; server_name xxx.xxx.com; #域名 ssl_certificate xxx.xxx.com.crt; ssl_certificate_key xxx.xxx.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ALL:!ADH:!EXPORT56:-RC4+RSA:+HIGH:+MEDIUM:-EXP; # Load configuration files for the default serverblock. location / { index index.html; root /www/server/nginx/html/; proxy_pass http://xxx.xxx.com; 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_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; send_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; client_max_body_size 8m; } }
OK!