ubunt mint配置nginx处理thinkphp框架

把dir替换为自己的项目路径
把fastcgi_pass unix替换为Unix监听php的socket文件路径即可
不想使用Unix方式处理php换为监听php的端口号即可
server
{
	listen 80;
	server_name lochvip.bairuishequ.com;

	root dir;
	index	index.php	

	access_log /var/log/nginx/menglin1042_access.log;
        error_log /var/log/nginx/menglin1042_error.log;

	location / {
		if (!-e $request_filename) {
			rewrite  ^(.*)$  /index.php?s=/$1  last;
			break;
		}
		#auth_basic "登录认证";
		#auth_basic_user_file /etc/nginx/pass_file;
		#allow 127.0.0.1;
		#deny all;
	}

#	location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
#		expires      30d;
#		error_log off;
#		access_log /dev/null;
#	}

#	location ~ .*\.(js|css)?$ {
#		expires      12h;
#		error_log off;
#		access_log /dev/null; 
#	}

       location ~ htyml{
		rewrite  ^(.*)$  /uPHzGEcadU.php  permanent;
	}

	error_page   500 502 503 504  /50x.html;
        error_page   404        /404.html;
        location = /50x.html {
            root   /var/www/nginx;
        }
        location = /404.html {
           root   /var/www/nginx;
        }

	location ~ \.php(.*)$ {
		#fastcgi_pass   127.0.0.1:9000;
		fastcgi_pass  unix:/run/php/php7.2-fpm.sock;
	    fastcgi_index index.php;

	        #为了支持pathinfo 增加如下设置
		#下面两句是给fastcgi权限,可以支持 ?s=/module/controller/action的url访问$
		fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

		#下面两句才能真正支持 index.php/index/index/index的pathinfo模式
		fastcgi_param  PATH_INFO  $fastcgi_path_info;
		fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
		fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:dir";
		include        fastcgi_params;
    }


   client_max_body_size 50M;
}

你可能感兴趣的:(Linux,nginx,php,thinkphp)