我有一些关于Nginx的问题,我似乎无法找到明确的答案。我目前正在使用我的WordPress Multisite - 图像没有显示出来。一个常见问题,通过一些.htaccess文件修改很容易解决。但是这个服务器使用Nginx,所以我需要深入研究nginx.conf。以下几个问题:
需要考虑的一些事项:
非常感谢您的帮助。
答案 0 :(得分:0)
- 我是否修改了sites-available / mysite文件,或者我应该使用html / nginx.conf来处理这类事情?
使用nginx时,首选使用自定义配置(sites-available / your-conf)。 nginx也可以通过这些配置用作负载平衡系统。
- 修改conf文件后是否需要重启Nginx? 是的你是。
下面是一个示例配置(已经使用正确的命名而不是wordpress运行。
另外,关于Wordpress Mulltisite的official documentation可能会给你一个想法。
server {
listen 80;
root /var/www/wordpress;
index index.php index.html index.htm;
access_log /var/log/nginx/wordpress.access.log;
error_log /var/log/nginx/wordpress.error.log;
# Make site accessible from http://localhost/
# Add wordpress.local.com to your hosts.conf file if not an alive host
server_name wordpress.local.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
include fastcgi.conf;
}