Hello Everybody…
i have upgraded my nginx to the stable version and i have a problem (pls
dont lough :p) it show me the “.php”-files first when i have a
“.html”-file in the doc_root… this was not previously.
Here my nginx.conf
user nginx nginx;
worker_processes 2;
events {
worker_connections 8048;
}
use epoll;
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 info;
server_tokens off;
sendfile on;
tcp_nopush on;
send_timeout 3m;
client_header_timeout 3m;
client_body_timeout 3m;
client_max_body_size 50m;
client_body_buffer_size 64k;
client_header_buffer_size 16k;
large_client_header_buffers 6 6k;
limit_zone one $binary_remote_addr 10m;
ignore_invalid_headers on;
keepalive_timeout 85 45;
tcp_nodelay on;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_http_version 1.0;
gzip_comp_level 1;
gzip_proxied any;
gzip_types text/plain text/html text/css text/xml
application/xml
text/javascript application/x-javascript
application/xml+rss;
include /etc/nginx/vhosts/*.conf;
#google_perftools_profiles /var/lib/nginx/nginx_profile;
}
and here my vhost.conf
server {
listen 80 default;
server_name www.domainsite.de domainsite.de;
access_log /var/log/nginx/domainsite.access.log main;
root /var/www/back2root;
location / {
autoindex off;
expires 0d;
index index.html index.htm index.php;
error_page 404 = /404.html;
error_page 500 502 503 504 = /50x.html;
rewrite ^/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
if ($request_filename ~ “.php$” ) {
rewrite ^(.*)$ /vbseo.php last;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /vbseo.php last;
}
}
php-cgi config
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_intercept_errors on;
break;
}
Password Protect important Directories
location ^~ /(288/|includes/|install/|vbseocp/|\.php).* {
auth_basic "RESTRICTED ACCESS";
auth_basic_user_file /etc/nginx/htaccess/hta-securevb_www;
access_log /var/log/nginx/securevb.log main;
}
}
Status
location /status {
stub_status on;
access_log off;
}
Limit Connection
location ~ \.php$ {
limit_conn one 16;
limit_except GET POST {
deny all; }
}
Cache Files
location ~* \.(jpg|jpeg|gif|css|png|ico|swf|js)$ {
root /var/www/domainsite;
access_log off;
expires 30d;
break;
}
Deny all htaccess
location ~ \.htaccess$ {
deny all;
}
}
Thanks for Help any hints to optimize my config are welcome it a
webserver for a vbulletin board…
Posted at Nginx Forum: