zoukankan      html  css  js  c++  java
  • nginx访问php程序相关配置

    server {
    	listen 			*:80;
    	charset			utf-8;
        server_name 	roujiaxiaomowang.wanghaokun.com mowang.crucco.com; 
        access_log  	/export/home/logs/third.vancl.com_access.log  	main;
    	error_log  		/export/home/logs/third.vancl.com_error.log  	warn;
    	#autoindex 		on;
    	
    	set $web_root 	WEB_ROOT;
        root            $web_root;
    
        rewrite         ^/(w+)_action/w+/?/?                                 /php_code/controller/$1.php break;
        rewrite         ^/(w+).html  	                                        /html_code/html/$1.html 	break;
        rewrite         ^/(w+).php												/php_code/third/$1.php 		break;
        rewrite         ^/js/(.+).js											/html_code/js/$1.js 		break;
        rewrite         ^/css/(.+)												/html_code/css/$1 		break;
        rewrite         ^/css/(.+).css											/html_code/css/$1.css 		break;
        rewrite         ^/image/(.+).png										/html_code/image/$1.png 	break;
     	rewrite         ^/image/(.+).gif                                       /html_code/image/$1.gif     break;
     	rewrite         ^/image/(.+).jpg  										/html_code/image/$1.jpg     break;
    
    	rewrite 		^/services/bookServiceImpl 							/soap/soap_server_bookitem.php break;
    	rewrite 		^/forBookCode/forBookCode_getEbookIdByWareId.action 	/bookitem/Ebook.php	break ;
    	rewrite 		^/list.* 												/php/list.php break;
    	rewrite 		^/d*.html 											/php/detail.php break;
    	rewrite 		^/(w+)$												/php/$1.php break;
    
    
    	location / {
    		#index 	/php/index.php;
        }
    
     	location ~ .php($|/) {
    		include fastcgi_params.default;
            #fastcgi_pass unix:/dev/shm/php-fcgi-search.sock;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php?IF_REWRITE=1;
    
            set $path_info "/";
            set $real_script_name $fastcgi_script_name;
            if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
                    set $real_script_name $1;
                    set $path_info $2;
            }
            fastcgi_param SCRIPT_NAME $real_script_name;
            fastcgi_param PATH_INFO $path_info;
    
            fastcgi_param SCRIPT_FILENAME $web_root$fastcgi_script_name;
       }
    
    	error_page  404              /404.html;
    
    # redirect server error pages to the static page /50x.html
    #
    	error_page   500 502 503 504  /50x.html;
    }
    

    WEB_ROOT改为项目实际要访问的绝对路径

    以上rewrite重写中,正则有误,都需要改为以下方式,需要对.进行反斜杠转义进行处理。

    rewrite         ^/(w+).php			/php_code/third/$1.php 		break;
    
  • 相关阅读:
    VMware workstation 无法连接到虚拟机
    windows10彻底卸载sql server2017
    MySQL 8.0.19安装教程(windows 64位)
    IntelliJ IDEA 编译程序出现 非法字符 的 解决方法
    IDEA手动增加lib目录
    Idea Svn 导出代码
    intellij idea设置打开多个文件显示在多行tab上及设置 tab上打开文件的上限
    IDEA工作空间多开项目教程,多个项目放在一起
    SpringBoot+Shiro引起事务失效、错误原因、解决方法
    flex:1;的含义
  • 原文地址:https://www.cnblogs.com/wanghaokun/p/7607854.html
Copyright © 2011-2022 走看看