简体   繁体   中英

how to config wordpress in nginx?

how guys , i have server that have 3 location ,

i config my nginx like :

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


    server_name www.zavie.co zavie.co 81.91.147.131;

    location / {
            root /home/zavie/zavieco/zavie;

            index index.php coming-soon.html index.htm index.nginx-debian.html;


    }
    location /word {
            index index.php index.html index.htm;
            root /home/zavie/zavieco/word;
             fastcgi_pass unix:/run/php/php7.2-fpm.sock;

    }
    location ~ /phpmyadmin {

            alias /home/zavie/zavieco/phpmyadmin;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            include snippets/fastcgi-php.conf;
    }
    location /static/ {
            root /home/zavie/zavieco/zavie360/zavie360;
    }
     location /zavie360 {

            alias /home/zavie/zavieco/zavie360;
}
}

but when i open zavie.co/word this will not open wordpress , how i can config this ?

Unless you have installed WordPress under /home/zavie/zavieco/word/word , you have used the wrong value for the root directive. See this document for details.

Your location /word block does not have the ability to serve WordPress's static assets.

Use something like this:

location ^~ /word {
    root /home/zavie/zavieco;
    index index.php;

    try_files $uri $uri/ /word/index.php;

    location ~ \.php$ {
        try_files $uri =404;

        include fastcgi_params;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME  $request_filename;
    }
}

See this document for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM