admin管理员组

文章数量:1332864

I'm a newbie of WordPress. My environment is Ubuntu 18 + Nginx + PHP 7.

Following the tutorial(/), the wordpress directory was placed on /var/www/html/device1.

Then I config the nginx, here is my nginx config:

server {
    listen 80;
    server_name www.device1 device1;

    server_name device1;

    root /var/www/html/device1;
    index index.php;


    # log files
    access_log /var/log/nginx/device1.access.log;
    error_log /var/log/nginx/device1.error.log;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;
    }

}

But, when I tried to connect to .php the Nginx responses 404, instead of returning the wordpress install page.

I don't have any idea of checking the issue. Thanks for your suggestion.

I'm a newbie of WordPress. My environment is Ubuntu 18 + Nginx + PHP 7.

Following the tutorial(https://www.myfreax/how-to-install-wordpress-with-nginx-on-ubuntu-18-04/), the wordpress directory was placed on /var/www/html/device1.

Then I config the nginx, here is my nginx config:

server {
    listen 80;
    server_name www.device1 device1;

    server_name device1;

    root /var/www/html/device1;
    index index.php;


    # log files
    access_log /var/log/nginx/device1.access.log;
    error_log /var/log/nginx/device1.error.log;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;
    }

}

But, when I tried to connect to http://device1/wp-admin/install.php the Nginx responses 404, instead of returning the wordpress install page.

I don't have any idea of checking the issue. Thanks for your suggestion.

Share Improve this question asked Jul 6, 2020 at 14:43 DennisLiDennisLi 101
Add a comment  | 

1 Answer 1

Reset to default 0

This is because the directory of wordpress is wrong.

the whole of wordpress files should have been extracted in /var/www/html/device1.

本文标签: phpWhy can39t I connect to the wordpress install page with Nginx