Created
July 10, 2012 00:26
-
-
Save rinatkhaziev/3080089 to your computer and use it in GitHub Desktop.
Example config of an nginx server (aka site)
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 { | |
## Your website name goes here. | |
server_name example.com; | |
listen 80; | |
## Your only path reference. | |
root /home/my/example/path/to/site; | |
error_log logs/example-error.log error; | |
access_log logs/example-access.log; | |
client_body_timeout 180; | |
client_body_buffer_size 8K; | |
client_header_buffer_size 1k; | |
large_client_header_buffers 4 16k; | |
## 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; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
# This is cool because no php is touched for static content | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment