nginx配置分解分享,另存为xxxx.conf放在linux环境下的/etc/nginx/conf.d/ 目录下,即可支持TP(ThinkPHP)的伪静态

29 篇文章 1 订阅
9 篇文章 0 订阅

server {
listen 443 ssl http2 default_server;
#listen [::]:443 ssl;
server_name dskk.grapis.club;
if (KaTeX parse error: Expected '}', got 'EOF' at end of input: … rewrite ^/(.*) https://dskk.graphis.club/$1 permanent;
}
#error_page 404 /data/web/kezhilian/404.html;

 ssl on;    #开启ssl支持
 ssl_certificate      /data/ssl/dskk.graphis.club.pem;    #指定服务器证书路径
 ssl_certificate_key  /data/ssl/dskk.graphis.club.key;    #指定私钥证书路径
 ssl_session_timeout  5m;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;     #指定SSL服务器端支持的协议版本
 #ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;    #指定加密算法
 #sl_prefer_server_ciphers   on;    #在使用SSLv3和TLS协议时指定服务器的加密算法要优先于客户端的加密算法 

 #	ssl_session_timeout 5m;
 #	ssl_session_cache shared:SSL:10m;
 #  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3;
 #	ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
 #	ssl_prefer_server_ciphers on;
 #	ssl_verify_client off;


root   /myweb/dskk;
location / {
    add_header Access-Control-Allow-Origin *;
    index  index.php index.html index.htm;
    if (!-e $request_filename) {
       rewrite  ^/(.*)$  /index.php/$1  last;
       break;
    }
}

location ~ \.php/?.*$ {
    add_header Access-Control-Allow-Origin *; 
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;

    #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            #Used in CentOS 20160801
            include        fastcgi_params;

     set $temp_script_name $fastcgi_script_name;
     if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
        set $temp_script_name $1;
        set $path_info $2;
     }
    fastcgi_param   PATH_INFO $path_info;
    fastcgi_param   SCRIPT_FILENAME   $document_root$temp_script_name;
    fastcgi_param   SCRIPT_NAME   $temp_script_name;
}

location ~ /\.ht {
    deny  all;
}

}

server {
listen 80;
#listen somename:8080;
server_name dskk.graphis.club;
client_max_body_size 80m;
#error_page 404 /data/ymg280/404.html;
#error_page 500 502 503 504 /errors/default/50x.html;

    if ($host != 'dskk.graphis.club'){
	rewrite ^/(.*)$ http://dskk.graphis.club/$1 permanent;
}
root /myweb/dskk;
location / {
    index  index.php index.html index.htm;
    if (!-e $request_filename) {  
       rewrite  ^/(.*)$  /index.php/$1  last;  
       break;  
    }  
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php/?.*$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;   

    #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	#Used in CentOS 20160801
	include        fastcgi_params;
	
	set $temp_script_name $fastcgi_script_name;  
     if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {  
        set $temp_script_name $1;  
        set $path_info $2;  
     }  
    fastcgi_param   PATH_INFO $path_info; 
    fastcgi_param   SCRIPT_FILENAME   $document_root$temp_script_name;  
    fastcgi_param   SCRIPT_NAME   $temp_script_name;  
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
    deny  all; 
}

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值