![Nginx:Wordpress:空白页](https://linux22.com/image/728999/Nginx%EF%BC%9AWordpress%EF%BC%9A%E7%A9%BA%E7%99%BD%E9%A1%B5.png)
当我尝试访问我的网络服务器时,我看到一个空白页。它被设置为与 wordpress 一起工作,但它却不能。
这是我的 wordpress.conf(位于 conf.d):
server {
listen 80;
#listen 443 default ssl;
server_name snapecraft.ddns.net;
root /var/www/html;
#ssl_certificate /etc/nginx/ssl/mydomain.crt;
#ssl_certificate_key /etc/nginx/ssl/mydomain.key;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;
index index.php index.phtml index.html;
error_page 500 502 503 504 404 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
当我curl -I snapecraft.ddns.net
这样做时结果是:
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.5
Date: Fri, 26 Oct 2018 16:41:11 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Location: https://snapecraft.ddns.net/
这是我的 nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
这是 php.ini 文件: https://pastebin.com/P6UccG70
当然我重新加载了 nginx 和 PHP
非常感谢您的帮助!
答案1
WordPress 可以设置为强制使用 https,但您已在 上注释掉这些行wordpress.conf
。您的服务器未在 HTTPS 上应答,但会重定向到 HTTPS。
您有两个选择:
- 使
http://snapecraft.ddns.net/
(不使用 TLS)成为您网站的规范地址。 - 设置 TLS 已启用
https://snapecraft.ddns.net/
。
如今,您应该选择选项 2。