Question

Stuck with LEMP centos 7 (page not found)

Hi, I have a problem with my server, I’m using LEMP stack on centos 7, cloudflare as DNS and wordpress. I can only access my website’s home maydara.ovh and the dashboard (maydara.ovh/wp-admin/*) but I can’t access any other page even the “Hello world!” native wordpress’s post is inaccessible all I get is “The page you are looking for cannot be found.” (I think its 404 error, correct if I’m wrong) Somebody help me please.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Replace your virtualhost with the following (I deleted some of the unnecessary comments and edited the line in red):

server {
    listen       80;
    server_name  maydara.ovh;

    root   /usr/share/nginx/html;
    index  index.php index.html index.htm;
    location / {
        try_files $uri $uri/ /index.php$is_args$args =404;
    }

    # process PHP files
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }   

    # deny access to .*
    location ~ /\. {
        deny  all;
    }
}

and restart nginx: sudo service nginx restart. Does that work?

Hi guys! on my server cents 7 have the probably the same problem… from nginx/error.log 2014/12/10 23:14:25 [error] 3031#0: *1 FastCGI sent in stderr: “Unable to open primary script: /scripts/test.php (No such file or directory)” while reading response header from upstream, client: 192.168.0.102, server: 192.168.0.150, request: “GET /test.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/php-fpm.sock:”, host: “192.168.0.150”

here is the nginx/default.conf <^> server { listen 80; server_name 192.168.0.150;

#charset koi8-r;
#access_log  /var/log/nginx/log/host.access.log  main;

location / {
    root   /usr/share/nginx/html;
    index index.php index.html index.htm;
}

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/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
# location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ .php$ { root /usr/share/nginx/html; fastcgi_index index.php; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }

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

}<^>

any ideas?