Welcome! Log In Create A New Profile


Re: _wordpress-cache in server name

December 01, 2010 07:49AM
Ian M. Evans Wrote:
> I saw this example for setting up nginx to run
> wordpress and wp-super cache
> server_name _wordpress-cache mydomain.com;
> root /var/www/wordpress_dir;
> server_name_in_redirect off;
> Can anyone explain to me what the
> "_wordpress-cache" is doing in the
> server name area. Guess I'm trying to wrap my head
> around new config
> options.
> Thanks!
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

That's my config. For one site, just remove that _wordpress-cache.

I was using that setup to avoid some issues with using the same configuration for many sites. If you're using one server config for a number of sites like this:

server_name _wordpress-cache site1.com site2.com site3.com site4.com site5.com;

Then the first server in the list gets used for certain things. It's the HTTP_SERVER variable used in some scripts. It's the "server" that appears in logs. It's the "server" that shows up in some email headers. So to avoid having site1.com appear for site2.com and site3.com log entries and email headers, I used to put in a bogus server name to identify the config. Although that didn't solve my problem with a certain php script that used HTTP_SERVER instead of HTTP_HOST.

I'm using another solution now to avoid the problem. I use a separate config file for each site and use an include file for the common config:

server {
listen xx.xx.xx.xx.xx:80;
server_name site1.com;
root /var/www/site1.com;
access_log /var/log/nginx/site1.com.access.log;
include /etc/nginx/config/wordpress-cache;

Then you put the entire config in your separate include file and only have one name listed for server_name.

This is the config: https://test.brianmercer.com/content/nginx-configuration-wordpress-wp-super-cache

I should reorganize those and put up a config for WP3 multisite and be clearer about how to reuse the config for multiple sites.
Subject Author Posted

_wordpress-cache in server name

Ian M. Evans November 30, 2010 10:18PM

Re: _wordpress-cache in server name

valor December 01, 2010 06:48AM

Re: _wordpress-cache in server name

brianmercer December 01, 2010 07:49AM

Re: _wordpress-cache in server name

Simone fumagalli December 01, 2010 12:26PM

Re: _wordpress-cache in server name

Ian M. Evans December 01, 2010 01:02PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 65
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready