Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2011

    ran into some problem with nginx ...

    Hi Guys,

    I've nginx installed as reverse proxy (port 80), and Apache (port 81) to serve dynamic pages (eg. wordpress and other stuff).

    When I tried to install wordpress, nginx display 404 errors on urls with query string.

    Eg: when trying to access:

    (the file "install.css" does exist in the directory)

    It displays:
    404 Not Found

    Any idea how to fix this?

    Many thanks!
    Last edited by vpswing; 06-15-2011 at 07:37 AM. Reason: need to add extra info.

  2. #2
    Join Date
    Apr 2011
    Ok, managed to solve it.

    When Cpanel created the new vhost, it did not update the nginx vhost.conf file - so nginx had no idea the new domain/vhost exist.

    What I did was to copy an existing vhost configuration (from the vhost.conf), edit it with the new domain's details and paste it back onto the vhost.conf file.

    Restart nginx. It works fine now!

    server {
      access_log off;
      error_log  logs/vhost-error_log warn;
      listen    80;
      # uncomment location below to make nginx serve static files instead of Apache
      # NOTE this will cause issues with bandwidth accounting as files wont be logged
      location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|js|css)$ {
       root   /path/to/public_html;
      location / {
       proxy_send_timeout   90;
       proxy_read_timeout   90;
       proxy_buffer_size    4k;
       # you can increase proxy_buffers here to suppress "an upstream response
       #  is buffered to a temporary file" warning
       proxy_buffers     16 32k;
       proxy_busy_buffers_size 64k;
       proxy_temp_file_write_size 64k;
       proxy_connect_timeout 30s;
       proxy_pass   http://aaa.bbb.ccc.ddd:81/;
       proxy_set_header   Host   $host;
       proxy_set_header   X-Real-IP  $remote_addr;
       proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

    1. replace "" with the actual domain

    2. replace "/path/to/public_html;" with the actual path to the directory where the html/php files resides

    3. Replace: aaa.bbb.ccc.ddd with the IP address of your VPS.


  3. #3
    Join Date
    Jan 2011

    Okay ! Great to hear that the issue is resolved. Reverse proxy is really a great technique. I have used this in the past with Apache and lighttpd as I wanted to serve a domain with lighttpd and the others with Apache.
    " Your work is to discover your work and then with all your heart to give yourself to it. "

    That's the mark of a true professional !

Similar Threads

  1. MySQL on Nginx problem
    By ScopeXL in forum Programming Discussion
    Replies: 11
    Last Post: 11-19-2010, 02:27 AM
  2. help nginx problem!
    By azfandak in forum Hosting Software and Control Panels
    Replies: 1
    Last Post: 01-03-2010, 12:02 AM
  3. Nginx problem IP
    By chupaqueedeuva in forum Hosting Security and Technology
    Replies: 1
    Last Post: 11-26-2009, 09:41 PM
  4. I ran out of mirrors for MySQL update problem
    By jailbird2 in forum Hosting Security and Technology
    Replies: 7
    Last Post: 11-08-2005, 12:14 PM
  5. domain ran out problem
    By ganz in forum Domain Names
    Replies: 4
    Last Post: 08-18-2004, 02:55 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