Created
September 28, 2011 14:01
-
-
Save alanbriolat/1248004 to your computer and use it in GitHub Desktop.
nginx userdir + PHP-FPM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
# ... other default site stuff, document root, etc. ... | |
location ~ ^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ { | |
alias /home/$userdir_user/public_html$userdir_uri; | |
index index.html index.htm index.php; | |
autoindex on; | |
include php5_generic; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
} |
The php5_generic cannot be included directly, it should be in a separate file. Otherwise it won't work.
Could this be modified to work with Gunicorn does anyone know?
@alanorth @nyuszika7h I too was able to use this on Ubuntu 18.04 by updating just the socket reference.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@alanorth Thanks! I added that to my nginx config (with a minor adjustment; the socket on Debian is
/var/run/php5-fpm.sock
) and it works perfectly.