Skip to content

Instantly share code, notes, and snippets.

@chrisjhoughton
Last active July 18, 2025 14:00
Show Gist options
  • Save chrisjhoughton/8646918 to your computer and use it in GitHub Desktop.
Save chrisjhoughton/8646918 to your computer and use it in GitHub Desktop.

Revisions

  1. chrisjhoughton revised this gist Jan 27, 2014. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?php
    // Add this to the top of your wp-config.php file.

    // Handle reverse proxy, passing the IP to the server.
    // This is used by some plugins to fetch the user's IP.
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
    $_SERVER['REMOTE_ADDR'] = $ips[0];
    }
    ?>
  2. chrisjhoughton revised this gist Jan 27, 2014. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  3. chrisjhoughton revised this gist Jan 27, 2014. No changes.
  4. chrisjhoughton revised this gist Jan 27, 2014. 2 changed files with 14 additions and 34 deletions.
    45 changes: 12 additions & 33 deletions apache.conf
    Original file line number Diff line number Diff line change
    @@ -1,38 +1,17 @@
    <VirtualHost *:8080>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    <VirtualHost *:{PORT}>

    ServerName www.yourdomain.com
    ServerAdmin [email protected]
    # ServerAlias docs
    DocumentRoot /var/www/docs/
    ServerName www.yourdomain.com
    ServerAdmin [email protected]
    DocumentRoot /var/www/yourdir/

    <Directory /var/www/docs>
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    allow from all
    </Directory>
    <Directory /var/www/yourdir>
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    3 changes: 2 additions & 1 deletion nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    # Add this file to your /etc/nginx/sites-available directory, renaming it to
    # the domain of your website. You'll also need to th change the server_name and port
    # the domain of your website.
    # Change the: server_name, port
    # Credit to http://mattkirman.com/2011/06/01/how-to-speed-up-wordpress-with-nginx/.
    server {
    listen 80;
  5. chrisjhoughton revised this gist Jan 27, 2014. 2 changed files with 43 additions and 2 deletions.
    38 changes: 38 additions & 0 deletions apache.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <VirtualHost *:8080>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.

    ServerName www.yourdomain.com
    ServerAdmin [email protected]
    # ServerAlias docs
    DocumentRoot /var/www/docs/

    <Directory /var/www/docs>
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    allow from all
    </Directory>


    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
    </VirtualHost>
    7 changes: 5 additions & 2 deletions yourdomain.com → nginx.conf
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    # Add this file to your /etc/nginx/sites-available directory, renaming it to
    # the domain of your website. You'll also need to th change the server_name and port
    # Credit to http://mattkirman.com/2011/06/01/how-to-speed-up-wordpress-with-nginx/.
    server {
    listen 80;
    server_name www.yourdomain.com;
    server_name www.yourdomain.com; # change this

    # global gzip on
    gzip on;
    @@ -11,7 +14,7 @@ server {
    add_header Cache-Control public;

    location / {
    proxy_pass http://127.0.0.1:{PORT};
    proxy_pass http://127.0.0.1:{PORT}; # change this
    proxy_buffering on;
    proxy_buffers 12 12k;
    proxy_redirect off;
  6. chrisjhoughton created this gist Jan 27, 2014.
    25 changes: 25 additions & 0 deletions yourdomain.com
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    server {
    listen 80;
    server_name www.yourdomain.com;

    # global gzip on
    gzip on;
    gzip_min_length 10240;
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
    gzip_disable "MSIE [1-6]\.";

    add_header Cache-Control public;

    location / {
    proxy_pass http://127.0.0.1:{PORT};
    proxy_buffering on;
    proxy_buffers 12 12k;
    proxy_redirect off;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    }


    }