Welcome! Log In Create A New Profile

Advanced

Is there a problem with my nginx.conf?

August 25, 2010 02:06PM
Hi,

I'm new with nginx, so i just copy paste my nginx.conf from some resources on internet. I just want to know if there's any mistakes or wrong configuration. Here it is
[code]
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

pid /var/run/nginx.pid;


#----------------------------------------------------------------------
# Events Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#----------------------------------------------------------------------

events {
worker_connections 1024;
}


#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#----------------------------------------------------------------------

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;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_proxied any;
gzip_http_version 1.0;
gzip_min_length 1100;
gzip_types text/plain text/css application/x-javascript text/xml application/xml
application/xml+rss text/javascript;
gzip_vary on;

# Load config files from the /etc/nginx/conf.d directory
proxy_cache_path /var/log/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
proxy_temp_path /var/log/cache/tmp;

include /etc/nginx/conf.d/*.conf;
#
# The default server
#

server {
listen 184.82.20.181:80;
server_name mywebsite.com;
charset utf-8;

access_log /var/log/nginx/mywebsite.access.log main;

#Serve Static Files
location ~ \.(ico|css|js|png|jpg|gif)$ {
root /home/mywebsite/public_html;
expires max;
access_log off;
proxy_cache my-cache;
proxy_cache_valid 200 302 600m;
proxy_cache_valid 404 600m;
}

#Serve XML Files
location ~ \.xml {
root /home/mywebsite/public_html;
proxy_cache my-cache;
proxy_cache_valid 200 302 20m;
proxy_cache_valid 404 600m;
}

location / {
if (-f $request_filename) {
break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}

#Block access to contact.php
location ~* (contact|ontact)\.php$ {
return 444;
access_log off;
}


proxy_pass http://127.0.0.1:8008;
expires 15m;
proxy_hide_header Pragma;
proxy_hide_header Cache-Control;
proxy_cache my-cache;
proxy_cache_valid 200 301 302 15m;
proxy_cache_valid 404 600m;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;

#Block bad bot
if ($http_user_agent ~* (libwww-perl|libcurl|wget|discobot|Exabot|Casper|kmccrew|plaNETWORK|RPT-HTTPClient)) {
return 444;
access_log off;
}
#Block No user agent
if ($http_user_agent = "") {
return 444;
access_log off;
}
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 300;
proxy_send_timeout 300;
}

#error page
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

}

[/code]

Thanks in advanced
SubjectAuthorPosted

Is there a problem with my nginx.conf?

sastroAugust 25, 2010 02:06PM

Re: Is there a problem with my nginx.conf?

Igor SysoevAugust 25, 2010 02:26PM

how to get remote_addr in ngix for POP/IMAP with perl module

moorthiOctober 28, 2010 10:59AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthiOctober 29, 2010 03:57AM

telnet imap not showing existing emails thru nginx

moorthiNovember 01, 2010 04:21AM

Re: telnet imap not showing existing emails thru nginx

moorthiNovember 01, 2010 05:03AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthiOctober 09, 2013 07:08AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

moorthiOctober 09, 2013 07:17AM

Re: how to get remote_addr in ngix for POP/IMAP with perl module

Maxim DouninOctober 28, 2010 11:22AM

Re: telnet imap not showing existing emails thru nginx

Maxim DouninNovember 01, 2010 04:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 103
Record Number of Users: 5 on November 26, 2014
Record Number of Guests: 173 on November 26, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready