mac 下安装lnmp环境

来源:互联网 发布:格林数据 编辑:程序博客网 时间:2024/05/18 00:17

安装命令
brew install nginx

nginx配置文件路径
/usr/local/etc/nginx/nginx.conf

nginx域名配置文件
/usr/local/etc/nginx/servers

添加域名配置文件,在servers下添加文件
www.zqcmyserver.com.conf

支持thinkphp的路由访问规则

server{        listen 80;         server_name www.zqcmyserver.com;        index index.htm index.html index.php;        root /Users/wxx/PhpstormProjects/zqc_myserv;        location / {           #访问路径的文件不存在则重写URL转交给ThinkPHP处理          if (!-e $request_filename) {              rewrite  ^/(.*)$  /index.php/$1  last;             break;          }       }       location ~ \.php/?.*$ {           fastcgi_pass   127.0.0.1:9000;          fastcgi_index  index.php;          #加载Nginx默认"服务器环境变量"配置          include        fastcgi.conf;          #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量          set $fastcgi_script_name2 $fastcgi_script_name;          if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {               set $fastcgi_script_name2 $1;            set $path_info $2;        }        fastcgi_param   PATH_INFO $path_info;        fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;        fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;    } }
0 0
原创粉丝点击