Skip to content

Instantly share code, notes, and snippets.

@stargt
Last active August 29, 2015 14:07
Show Gist options
  • Save stargt/6b2f1b58bf969e0e2e8f to your computer and use it in GitHub Desktop.
Save stargt/6b2f1b58bf969e0e2e8f to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name localhost;
root /home/bookworm/Sites;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(ht|git|svn) {
deny all;
}
}
server {
listen 80;
server_name .local;
if (-d /home/bookworm/Sites/$rootpath/public) {
set $rootpath $rootpath/public;
}
root /home/bookworm/Sites/$rootpath;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(ht|git|svn) {
deny all;
}
}
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
map $http_host $rootpath {
~^(?<domain>.+)\.local$ $domain;
default /;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment