0

My server only returns a 404 error, regardless of the configuration that I do.

File /etc/nginx/sites-available/name.​net:

    server {
        listen 80;
        listen [::]:80;


        root /home/name/public_html;
        index   index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name domain.net www.domain.net;

        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }
        #modificacao Danilo
        location ~ \.php$ {
                #try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_cache  microcache;
                fastcgi_cache_key $scheme$host$request_uri$request_method;
                fastcgi_cache_valid 200 301 302 30s;
                fastcgi_cache_use_stale updating error timeout invalid_header http_500;
                fastcgi_pass_header Set-Cookie;
                fastcgi_pass_header Cookie;
                fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        #modificacao Danilo
        location ~* \.(woff|eot|ttf|svg|mp4|webm|jpg|jpeg|png|gif|ico|css|js)$ {
                 access_log        off;
                 log_not_found     off;
                 expires           12d;
        }
          #Danilo semCache
        set $no_cache "";
        if ($request_method = POST)
        {
                set $no_cache 1;
        }
        if ($request_uri ~* "/(wp-admin/|wp-login.php)")
        {
        set $no_cache 1;
        }
        if ($http_cookie ~* "wordpress_logged_in_")
        {
        set $no_cache 1;
        }
        #location ~ /(wp-config.php|readme.html|licence.txt) {
        #       return 404;
        #}
        #if ($request_method !~ ^(GET|POST|HEAD)$ ) {
        #       return 444;
        #}
}

ls -la /home/name.net/public_html/:

image

techraf
  • 4,243
  • 8
  • 29
  • 44
Danilo D
  • 113
  • 6
  • Check your error log. – Michael Hampton Jul 26 '16 at 22:59
  • The file is Empty but acess.log has the line ... "GET / HTTP/1.1" 404 579 "-" "Mozilla/5.0 ("... – Danilo D Jul 26 '16 at 23:04
  • You've configured something incorrectly, could be Nginx, could be Wordpress, hard to say if there's no error log. Check the PHP error log. You can look at my Nginx/Wordpress configuration in a tutorial I have available here https://www.photographerstechsupport.com/tutorials/hosting-wordpress-on-aws-tutorial-pt1-introduction-configuration-downloads/ – Tim Jul 27 '16 at 02:55
  • 1
    Have you added symlink to sites-enabled? – Alexey Ten Jul 27 '16 at 08:19

0 Answers0