Skip to content

Instantly share code, notes, and snippets.

@s3w47m88
Last active February 6, 2019 18:59
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 s3w47m88/9b62ceedad8fb97e041e768fef5c94f8 to your computer and use it in GitHub Desktop.
Save s3w47m88/9b62ceedad8fb97e041e768fef5c94f8 to your computer and use it in GitHub Desktop.
Default MAMP NGinx Configuration file + WordPress (Not Working)
#load_module "modules/ngx_http_image_filter_module.so";
#load_module "modules/ngx_http_perl_module.so";
#load_module "modules/ngx_http_xslt_filter_module.so";
#load_module "modules/ngx_mail_module.so";
#load_module "modules/ngx_stream_module.so";
user s3w47m88 staff;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type text/html;
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
sendfile on;
server {
listen 7888 default_server;
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
root "/Users/s3w47m88/Projects";
access_log /Applications/MAMP/logs/nginx_access.log;
error_log /Applications/MAMP/logs/nginx_error.log;
location / {
index index.html index.php;
}
location ~* /MAMP([^-].*)$ {
root /Applications/MAMP/bin;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ~* /phpMyAdmin(.*)$ {
root /Applications/MAMP/bin;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ~* /phpPgAdmin(.*)$ {
root /Applications/MAMP/bin;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ~* /phpLiteAdmin(.*)$ {
root /Applications/MAMP/bin;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ~* /adminer(.*)$ {
root /Applications/MAMP/bin;
index adminer.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location /icons {
alias /Applications/MAMP/Library/icons;
autoindex on;
}
location /favicon.ico {
alias /Applications/MAMP/bin/favicon.ico;
# log_not_found off;
# access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\. {
deny all;
}
# location ~* \.(gif|jpg|png|pdf)$ {
# expires 30d;
# }
# location = /robots.txt {
# allow all;
# log_not_found off;
# access_log off;
# }
# location ~* \.(txt|log)$ {
# allow 127.0.0.1;
# deny all;
# }
# location ~ \..*/.*\.php$ {
# return 403;
# }
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
## Your website name goes here.
server_name domain.tld;
## Your only path reference.
root /var/www/wordpress;
## This should be in your http block and if it is, it's not needed here.
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "$is_args$args" so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
access_log off;
log_not_found off;
}
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment