Nginx: Unterschied zwischen den Versionen
Aus Alexander's Wiki
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) K |
||
Zeile 2: | Zeile 2: | ||
server { | server { | ||
listen 80; | listen 80; | ||
server_name | server_name arm; | ||
access_log /var/log/nginx/ | access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/ | error_log /var/log/nginx/error.log; | ||
rewrite_log on; | rewrite_log on; | ||
root /var/www/app/webroot; | root /var/www/app/webroot; | ||
index index.php index.html index.htm; | index index.php index.html index.htm; | ||
client_max_body_size 100M; | |||
# Not found this on disk? | # Not found this on disk? | ||
Zeile 20: | Zeile 20: | ||
# Pass the PHP scripts to FastCGI server | # Pass the PHP scripts to FastCGI server | ||
# listening on 127.0.0.1:9000 | # listening on 127.0.0.1:9000 | ||
# | # location ~ \.php$ { | ||
# fastcgi_pass unix:/tmp/php.socket; | |||
# #fastcgi_pass 127.0.0.1:9000; | |||
# fastcgi_index index.php; | |||
# fastcgi_intercept_errors on; # to support 404s for PHP files not found | # fastcgi_intercept_errors on; # to support 404s for PHP files not found | ||
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |||
# include fastcgi_params; | |||
# } | |||
location ~ \.php$ { | |||
location ~ \.php$ { | |||
try_files $uri =404; | try_files $uri =404; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
Zeile 39: | Zeile 40: | ||
fastcgi_index index.php; | fastcgi_index index.php; | ||
include fastcgi_params; | include fastcgi_params; | ||
} | |||
# Static files. | # Static files. |
Version vom 10. April 2014, 19:52 Uhr
server {
listen 80;
server_name arm;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
rewrite_log on;
root /var/www/app/webroot;
index index.php index.html index.htm;
client_max_body_size 100M;
# Not found this on disk?
# Feed to CakePHP for further processing!
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
# Pass the PHP scripts to FastCGI server
# listening on 127.0.0.1:9000
# location ~ \.php$ {
# fastcgi_pass unix:/tmp/php.socket;
# #fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_intercept_errors on; # to support 404s for PHP files not found
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
# }
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# Static files.
# Set expire headers, Turn off access log
location ~* \favicon.ico$ {
access_log off;
expires 1d;
add_header Cache-Control public;
}
location ~ ^/(img|cjs|ccss)/ {
access_log off;
expires 7d;
add_header Cache-Control public;
}
# Deny access to .htaccess files,
# git & svn repositories, etc
location ~ /(\.ht|\.git|\.svn) {
deny all;
}
}