nginx 配置 解決 vue history模式下空白 ,以及SSL證書安裝

原文地址

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;

    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    
	

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    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;
    #    }
    #}
	
	
	
	# HTTPS server   //自定義HTTPS配置
	    server { 
	        listen 443 ssl; 
	        server_name www.55776.club;   #你的域名
	        root html; #你的網站根目錄
	        index index.php index.html index.htm; #網站默認訪問文件
	        
	        ssl_certificate   ../cert/55.crt; 
	        ssl_certificate_key  ../cert/55.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   html;
					try_files $uri $uri/ /baiyi/$query_string;
			}
	
	        location ~ \.php(.*)$  { #HP必須的配置,否則瀏覽器訪問會直接下載php源碼文件
	           fastcgi_pass   127.0.0.1:9000;
	           fastcgi_index  index.php;
	           fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
	           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	           fastcgi_param  PATH_INFO  $fastcgi_path_info;
	           fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
	           include        fastcgi_params;
			}
	}
	    
		
	
	server {
	    listen 80 ssl;
	    server_name www.55776.club;
	
	    #charset koi8-r;
	    #access_log  logs/host.access.log  main;
		
		root html/baiyi; #你的網站根目錄
		index index.php index.html index.htm; #網站默認訪問文件
		
	    location / {
	        root   html;
	        #index  index.html index.htm;
			try_files $uri $uri/ /baiyi/$query_string;
	    }
	    #error_page  404      /404.html;
	    # redirect server error pages to the static page /50x.html
	    #
		
	    error_page   500 502 503 504  /50x.html;
	    location = /50x.html {
	        root   html;
	    }
		
	    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
	    #
	    #location ~ \.php$ {
	    #    proxy_pass   http://127.0.0.1;
	    #}
	    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	    #
	    #location ~ \.php$ {
	    #    root           html;
	    #    fastcgi_pass   127.0.0.1:9000;
	    #    fastcgi_index  index.php;
	    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
	    #    include        fastcgi_params;
	    #}
	
	    # deny access to .htaccess files, if Apache's document root
	    # concurs with nginx's one
	    #
	    #location ~ /\.ht {
	    #    deny  all;
	    #}
		
		
		ssl_certificate   ../cert/55.crt;
		ssl_certificate_key  ../cert/55.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 ~ \.php(.*)$  { #HP必須的配置,否則瀏覽器訪問會直接下載php源碼文件
		   fastcgi_pass   127.0.0.1:9000;
		   fastcgi_index  index.php;
		   fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
		   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		   fastcgi_param  PATH_INFO  $fastcgi_path_info;
		   fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
		   include        fastcgi_params;
		}
		
	}

}
```![在這裏插入圖片描述](https://img-blog.csdnimg.cn/20200403144405469.jpg)

## [查看面試題](https://www.55776.club/baiyi/web)

![在這裏插入圖片描述](https://img-blog.csdnimg.cn/20200403144353843.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80Mjk4MTU2MA==,size_16,color_FFFFFF,t_70)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章