Mac安装nginx

搜索
brew search nginx

下载
brew install nginx

配置
cd /usr/local/etc/nginx/

mkdir conf.d

vim nginx.conf

vim ./conf.d/default.conf

修改:nginx.conf
worker_processes1;error_log/usr/local/var/log/nginx/error.log warn;pid/usr/local/var/run/nginx.pid;events{worker_connections256;}http{include mime.types;default_type application/octet-stream;log_format main'$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log/usr/local/var/log/nginx/access.log main;port_in_redirect off;sendfile on;keepalive_timeout65;include/usr/local/etc/nginx/conf.d/*.conf;

新建:conf.d/default.conf
server{
    listen8080;server_name localhost;root/Users/user_name/nginx_sites/;
    # 该项要修改为你准备存放相关网页的路径
    location/{
        index index.php;autoindex on;
    }
#proxy the php scripts to php-fpm
    location~\.php${
        include/usr/local/etc/nginx/fastcgi.conf;fastcgi_intercept_errors on;
        fastcgi_pass127.0.0.1:9000;
    }
}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容