首页 > 系统服务 > 详细

mac 下 nginx的安装

时间:2016-03-05 14:41:18      阅读:272      评论:0      收藏:0      [点我收藏+]

1. 使用 brew 安装 nginx 

  brew install nginx 

2.打开ngnix 

  sudo nginx 

  -- 重启ngnix

  ngnix -s reload

 

3. 关于php  ,默认使用 mac 上的php ,先配置 ,再开启 php-fpm

  sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf vim /private/etc/php-fpm.conf

  sudo  php-fpm

 

4.找到 /usr/local/etc/nginx/nginx.conf , 配置虚拟主机(###|$$$ 根据主机而定)

server {

        listen       80;

        server_name  www.####.com;

        root /Users/#####/$$$$$;

        index  index.html index.htm index.php;

 

        location / {

            root   html;

            index  index.html index.htm;

            if (!-e $request_filename) {

                #rewrite ^/(.*)$ /index.php?$1 last;

                rewrite "^/(.*)$" /index.php last; #这一条很重要

            }

                rewrite ^/$/index.php last;

        }

            location ~ .*\.php$

        {

            include fastcgi.conf;

            fastcgi_pass  127.0.0.1:9000;

            fastcgi_index index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            fastcgi_param   PATH_INFO      $fastcgi_path_info;

            include fastcgi_params;

            expires off;

        }

    }

mac 下 nginx的安装

原文:http://www.cnblogs.com/zeopean/p/5244731.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!