Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2005
    Location
    Europe
    Posts
    95

    little help with nginx

    Hi,

    Can anyone tell me if there is anything wrong in these nginx config files?

    default website (nginx.conf):

    user nginx;
    worker_processes 1;

    # main server error log
    error_log /var/log/nginx/error.log ;
    pid /var/run/nginx.pid;

    events {
    worker_connections 1024;
    }


    # main server config
    http {
    include 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"';

    sendfile on;
    #tcp_nopush on;
    #keepalive_timeout 0;
    keepalive_timeout 65;
    gzip on;

    server {
    listen IP:80 default;
    server_name _;
    access_log /var/log/nginx/access.log main;
    server_name_in_redirect off;
    location / {
    index index.html;
    root /var/www/domains/default
    ;
    }
    }

    # virtual hosting
    include /etc/nginx/conf.d/vhosts/*;
    }
    Site 1:
    server {
    listen 80 default;
    server_name domain.com www.domain.com;

    access_log /var/log/nginx/domain.com.access.log main;

    location / {
    root /var/www/domains/domain.com;
    index index.php index.html index.htm;
    }

    # enforce www (exclude certain subdomains)
    if ($host !~* ^(www|subdomain))
    {
    rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
    }


    # canonicalize codeigniter url end points
    # if your default controller is something other than "welcome" you should change the following
    if ($request_uri ~* ^(/welcome(/index)?|/index(.php)?)/?$)
    {
    rewrite ^(.*)$ / permanent;
    }

    # removes trailing "index" from all controllers
    if ($request_uri ~* index/?$)
    {
    rewrite ^/(.*)/index/?$ /$1 permanent;
    }

    # removes trailing slashes (prevents SEO duplicate content issues)
    if (!-d $request_filename)
    {
    rewrite ^/(.+)/$ /$1 permanent;
    }

    # removes access to "system" folder, also allows a "System.php" controller
    if ($request_uri ~* ^/system)
    {
    rewrite ^/(.*)$ /index.php?/$1 last;
    break;
    }

    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename)
    {
    rewrite ^/(.*)$ /index.php?/$1 last;
    break;
    }


    # 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 /var/www/domains/domain.com$fastcgi_script_name;
    include fastcgi_params;
    }

    location ~ /\.ht {
    deny all;
    }
    }
    Second site:
    server {
    listen IP:80;
    server_name www.domain.net;

    access_log /var/log/nginx/domain.net-access.log main;

    location / {
    root /var/www/domains/facebook;
    index index.php;
    }

    error_page 404 /404.html;

    # 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 /var/www/domains/facebook$fastcgi_script_name;
    include fastcgi_params;
    }

    location ~ /\.ht {
    deny all;
    }
    }
    I am having some difficulties having one site to work and I can't figure it out

    Thanks!
    Last edited by xcpd; 05-02-2011 at 10:24 PM.

Similar Threads

  1. Nginx Admin: The Free cPanel Nginx automated installer Plugin
    By JohnCS in forum Software & Scripts Offers
    Replies: 13
    Last Post: 05-21-2011, 11:45 AM
  2. Help me nginx please
    By funk999 in forum Programming Discussion
    Replies: 8
    Last Post: 04-21-2011, 04:15 PM
  3. Nginx
    By chupaqueedeuva in forum Hosting Security and Technology
    Replies: 16
    Last Post: 12-30-2010, 04:14 PM
  4. what about Nginx
    By ante in forum Hosting Security and Technology
    Replies: 15
    Last Post: 12-08-2010, 10:35 PM
  5. help nginx
    By imanewbie in forum VPS Hosting
    Replies: 5
    Last Post: 06-19-2010, 11:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •