Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@victusfate
Created November 21, 2017 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victusfate/3f4996ee7c506674059e913b2b352811 to your computer and use it in GitHub Desktop.
Save victusfate/3f4996ee7c506674059e913b2b352811 to your computer and use it in GitHub Desktop.
setup nginx + php 7.1 on mac os high sierra

installed php 7.1 with phpbrew

see https://github.com/phpbrew/phpbrew for installation

install php 7.1 custom stuff

phpbrew install 7.1 +cli +fpm +json +curl +mbstring  +mysql +opcache +readline +xml

I needed to run php-fpm with phpbrew

phpbrew fpm start

and in the php-fpm config file /Users//.phpbrew/php/php-7.1.11/etc/php-fpm.conf this file is included /Users//.phpbrew/php/php-7.1.11/etc/php-fpm.d/www.conf and in www.conf the socket listen was set to

listen = /Users/<user>/.phpbrew/php/php-7.1.11/var/run/php-fpm.sock

so updating fastcgi_pass in nginx.conf connected it /usr/local/etc/nginx/nginx.conf

fastcgi_pass   unix:/Users/messel/.phpbrew/php/php-7.1.11/var/run/php-fpm.sock;

full server block in nginx.conf

server {
    listen 8080 default_server;
    server_name  localhost;

    root /Users/messel/Desktop/Dropbox/code/<pathToCode>;
    access_log  /usr/local/Cellar/nginx/1.12.2_1/logs/access.log;
    index index.html index.php;

    location ~ \.php$ {
        try_files      $uri /index.html index.php;
        fastcgi_pass   unix:/Users/messel/.phpbrew/php/php-7.1.11/var/run/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }        
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment