Mac安裝nginx+php-fpm

第一步:安裝brewjavascript

訪問地址:
https://brew.sh/


/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 

第二步:安裝nginxphp

brew install nginx

 

第三步:配置hostscss

127.0.0.1       augu.xiaocx.my
127.0.0.1       xdf.xiaocx.my
127.0.0.1       wtk.xiaocx.my

 

第四步: 配置 Nginx文件夾下的,xdf.com.confhtml

server {
    listen       80;
    server_name  xdf.xiaocx.my;
    root         /Users/jihaichuan/Work/2018/xdf2/api;

    index        index.php index.html index.htm;

    client_max_body_size 20m;
    fastcgi_read_timeout 600;


    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";



    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
    #    root   /var/www/smallcx;
    #    index  index.html index.htm;
        if (!-e $request_filename) {
              rewrite  ^(.*)$  /index.php?s=$1  last;
              break;
        }
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        #root   /var/www/www.xiaocx.org;
    }

    location @rewrite {
        rewrite ^ /index.php;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
    #    root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;


        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;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 

第五步: 配置php-fpmjava

vim /etc/php-fpm.d/www.conf

#把user打開,改爲
user=nginx

 

第六步: 修改nginx.conf 文件目前權限nginx

# jihaichuan 是當前用戶
# staff 屬於用戶組
user jihaichuan staff;

 

第七步:批量修改文件所屬組git

#nginx目前所屬權限
chown jihaichuan:staff /usr/local/etc/nginx

#項目源代碼所屬權限
chown jihaichuan:staff /Work/2018

 

第八步: 重啓Nginx 、PHP-fpmgithub

#nginx
sudo nginx -t
sudo nginx -s reload


#php-fpm  我記得這個好想是經過殺死進程來處理的
相關文章
相關標籤/搜索