我正在尝试在具有LEMP堆栈的Digital Ocean Droplet上设置Wordpress网站。我以前从未使用过NGINX,并且对如何在一个Droplet上托管多个站点感到困惑。我首先尝试建立并运行一个站点。我的域似乎正确指向了小滴,但此刻我所得到的只是一张空白的白纸。谁能看到我哪里出问题了?
我已经在nginx目录中创建了sites-available和sites-enabled目录。在sites-available文件夹中,我有一个名为“ mywebsite.com”的文件,它从sites-available链接到启用了sites的文件:
server {
server_name www.mywebsite.co.uk;
rewrite ^/(.*)$ http://mywebsite.co.uk/$1 permanent;
}
server {
server_name mywebsite.co.uk;
root /var/www/html/mywebsite.co.uk;
access_log /var/log/nginx/www.mywebsite.co.uk.access.log;
error_log /var/log/nginx/www.mywebsite.co.uk.error.log;
include global/common.conf;
include global/wordpress.conf;
}
我在nginx目录中创建了另一个名为“ global”的目录,其中包含以下内容:
common.conf
# Global configuration file.
listen 80;
index index.php index.html index.htm;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ /\. {
deny all;
}
location ~* ^.+\.
(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif| png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires 30d;
}
wordpress.conf
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2
last;
任何帮助将不胜感激,谢谢!