Last active
November 13, 2023 17:47
-
-
Save frdmn/7853158 to your computer and use it in GitHub Desktop.
Nginx and PHP-FPM configuration + default virtual host
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
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' | |
alias nginx.restart='nginx.stop && nginx.start' | |
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist" | |
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist" | |
alias php-fpm.restart='php-fpm.stop && php-fpm.start' | |
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" | |
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" | |
alias mysql.restart='mysql.stop && mysql.start' | |
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log' | |
alias nginx.logs.access='tail -250f /usr/local/etc/nginx/logs/access.log' | |
alias nginx.logs.default.access='tail -250f /usr/local/etc/nginx/logs/default.access.log' | |
alias nginx.logs.default-ssl.access='tail -250f /usr/local/etc/nginx/logs/default-ssl.access.log' | |
alias nginx.logs.phpmyadmin.error='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.error.log' | |
alias nginx.logs.phpmyadmin.access='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.access.log' |
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
worker_processes 1; | |
error_log /usr/local/etc/nginx/logs/error.log debug; | |
events { | |
worker_connections 1024; | |
} | |
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/etc/nginx/logs/access.log main; | |
sendfile on; | |
keepalive_timeout 65; | |
index index.html index.php; | |
include /usr/local/etc/nginx/sites-enabled/*; | |
} |
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$ { | |
try_files $uri = 404; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} |
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; | |
root /var/www/; | |
access_log /usr/local/etc/nginx/logs/default.access.log main; | |
location / { | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
} | |
location = /info { | |
allow 127.0.0.1; | |
deny all; | |
rewrite (.*) /.info.php; | |
} | |
error_page 404 /404.html; | |
error_page 403 /403.html; | |
} |
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 443; | |
server_name localhost; | |
root /var/www/; | |
access_log /usr/local/etc/nginx/logs/default-ssl.access.log main; | |
ssl on; | |
ssl_certificate ssl/localhost.crt; | |
ssl_certificate_key ssl/localhost.key; | |
ssl_session_timeout 5m; | |
ssl_protocols SSLv2 SSLv3 TLSv1; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
location / { | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
} | |
location = /info { | |
allow 127.0.0.1; | |
deny all; | |
rewrite (.*) /.info.php; | |
} | |
error_page 404 /404.html; | |
error_page 403 /403.html; | |
} |
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 306; | |
server_name localhost; | |
root /usr/local/share/phpmyadmin; | |
error_log /usr/local/etc/nginx/logs/phpmyadmin.error.log; | |
access_log /usr/local/etc/nginx/logs/phpmyadmin.access.log main; | |
ssl on; | |
ssl_certificate ssl/phpmyadmin.crt; | |
ssl_certificate_key ssl/phpmyadmin.key; | |
ssl_session_timeout 5m; | |
ssl_protocols SSLv2 SSLv3 TLSv1; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the simplicity I am looking for 👍