2

First, i must say that i am not expert in server administration, my site was setup by hosting admins (that i cannot contact anymore).

Few days ago, i updated Nginx to latest version (admin told me that it is safe to do). But after that, my site serves only html content, no CSS, images, JS. If i try to open some image i get message "Wellcome to Nginx" (same thin if i try to open static.mysitedomain.com).

More details: Site has static. subdomain, but static files are in same directory as they used to be before setting up static files. I was googling for some solutions, i tried to change something in /etc/nginx/, but no luck.

I feel that this is some minor configuration problem, any ideas?

EDIT:

Here is /etc/nginx/nginx.conf file content:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

 events {
worker_connections 768;
# multi_accept on;
 }

 http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Here is /etc/nginx/sites-enabled/default file content:

 server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to index.html
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            deny all;
    }

    # Only for nginx-naxsi : process denied requests
    #location /RequestDenied {
            # For example, return an error code
            #return 418;
    #}

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #error_page 500 502 503 504 /50x.html;
    #location = /50x.html {
    #       root /usr/share/nginx/www;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #       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;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
 }


 # another virtual host using mix of IP-, name-, and port-based configuration
 #
 #server {
 #       listen 8000;
 #       listen somename:8080;
 #       server_name somename alias another.alias;
 #       root html;
 #       index index.html index.htm;
 #
 #       location / {
 #               try_files $uri $uri/ /index.html;
 #       }
 #}


 # HTTPS server
 #
 #server {
 #       listen 443;
 #       server_name localhost;
 #
 #       root html;
 #       index index.html index.htm;
 #
 #       ssl on;
 #       ssl_certificate cert.pem;
 #       ssl_certificate_key cert.key;
 #
 #       ssl_session_timeout 5m;
 #
 #       ssl_protocols SSLv3 TLSv1;
 #       ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
 #       ssl_prefer_server_ciphers on;
 #
 #       location / {
 #               try_files $uri $uri/ /index.html;
 #       }
 #}
10
  • What is your configuration? Sep 1, 2012 at 14:03
  • You think nginx.config? I edited my post.
    – SomeoneS
    Sep 1, 2012 at 14:11
  • ls /etc/nginx/conf.d/? ls /etc/nginx/sites-enabled/?
    – quanta
    Sep 1, 2012 at 14:48
  • @quanta folder conf.d is empty, sites-enabled contains file named "default1" and some shortcut named "default" (looking through filezilla)
    – SomeoneS
    Sep 1, 2012 at 14:58
  • cat /etc/nginx/sites-enabled/default?
    – quanta
    Sep 1, 2012 at 14:58

1 Answer 1

1

I updated "default" file in sites-avaivable with this code:

  server{
    listen 80;
    server_name wordpress; 
    access_log /var/log/wordpress.access_log;
    error_log /var/log/wordpress.error_log;

    location / {
      root /home/your-user-name/Sites/wordpress;
      index index.php index.html index.htm;

      if (-f $request_filename) {
          expires 30d;
          break;
      }

      # this sends all non-existing file or directory requests to index.php
      if (!-e $request_filename) {
          rewrite ^(.+)$ /index.php?q=$1 last;
      }
    }

    location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /home/your-user-name/Sites/wordpress
        $fastcgi_script_name;
        include         fastcgi_params;
    }
  }

I think problem was in fastcgi setings that was not found in my "default" file. Here is more detailed process: http://rubyist-journal.com/2010/03/13/howto-nginx-wordpress-ubuntu-shortest-setup/

2
  • No fair. You never told us this was a WordPress site, nor gave us this log file to look at. Sep 4, 2012 at 17:56
  • Well, sorry, i am total noob in server administration, so i did not know that is important what CMS i use :D And what log file?
    – SomeoneS
    Sep 4, 2012 at 19:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.