简体   繁体   中英

Nginx.conf file for WordPress multisite

I've got a few questions about Nginx that I can't seem to find a clear answer on. I'm currently having with my WordPress Multisite—the images aren't showing up. A common problem, easily solved with some .htaccess file modifications. But this server uses Nginx, so I need to dig into nginx.conf. A few questions below:

  • Do I modify the sites-available/mysite file, or should I be using the html/nginx.conf for this type of thing?
  • Do I need to restart Nginx after modifying my conf files?

A few things to consider:

  • I'm using subdirectories in my WordPress multisite
  • The site is loading and functioning properly, the WordPress configuration—or rather, some of its required redirects—are the only thing that needs to be altered.

Thanks so much for any help.

  • Do I modify the sites-available/mysite file, or should I be using the html/nginx.conf for this type of thing?

Using custom configurations (sites-available/your-conf) is prefered when using nginx. nginx can also be used as a load-balance system just by these configs.

  • Do I need to restart Nginx after modifying my conf files? Yes you do.

Below is an sample configuration (which is already running with proper naming instead of wordpress.

Also, official documentation about Wordpress Mulltisite may give you an idea.

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;
    }

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