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 and the dashboard (*) 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;

    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:, server:, request: “GET /test.php HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/php-fpm.sock:”, host: “”

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

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

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?