worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

   ##前后端
    server {	
	    ##前台88
	    listen 88 ssl;
        server_name  baidu.com;
		charset utf-8;
        index index.html index.htm;
        ###https配置 ---
        ssl_certificate  /usr/local/nginx/conf/ssl.pem;
        ssl_certificate_key /usr/local/nginx/conf/ssl.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;
		location / {
            root   /home/test/vue/dist;
            try_files $uri $uri/ /index.html;
            index  index.html index.htm;
        }
		location /prod-api/ {
			proxy_ssl_server_name on;
			proxy_ssl_session_reuse off;
			proxy_set_header Host $http_host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header REMOTE-HOST $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			##后台 8088
			proxy_pass http://11.111.111.11:8088/;
		}        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
	##静态资源
	server {
        listen       1234 ssl;
		server_name  taiyiint.com;
		charset utf-8;
        index index.html index.htm;
		###https配置 ---
        ssl_certificate  /usr/local/nginx/conf/ssl.pem;
        ssl_certificate_key /usr/local/nginx/conf/ssl.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;
        ###实际文件/home/test/static/静态文件
        location /static{
           root   /home/test/;
		   autoindex on;
        }

    }

}

Logo

快速构建 Web 应用程序

更多推荐