• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
      • Try XenForo Demo
      • New Posts
      • FAQ
      • Calendar
      • Community
        • Groups
        • Albums
        • Member List
      • Forum Actions
        • Mark Forums Read
      • Quick Links
        • Today's Posts
        • Who's Online
      • Sponsor
        • Sponsor a Feature
        • List of Donors
    • Wiki
    • Support
    • What's New?
    • Buy Now
    • Manual
    • 
    • Forum
    • VaultWiki How-Tos
    • VaultWiki Questions
    • Rewriting nginx proxy to apache

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Results 1 to 3 of 3

    Thread: Rewriting nginx proxy to apache

    • Thread Tools
      • Show Printable Version
    1. August 10, 2010 #1
      Moses
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      Moses is offline
      Junior Member
      Join Date
      November 19, 2009
      Posts
      46
      Rep Power
      203

      Rewriting nginx proxy to apache

      Hello,
      I've got nginx set up to serve static files and proxy all other requests to apache... following is my setup

      Quote Originally Posted by nginx sites-enabled
      server {
      listen 80;
      server_name greenandgoldrugby.com;
      rewrite ^/(.*) http://www.greenandgoldrugby.com/$1 permanent;
      }

      server {

      listen 80;
      server_name www.greenandgoldrugby.com;

      access_log /home/public_html/greenandgoldrugby.com/log/nginx-access.log;
      error_log /home/public_html/greenandgoldrugby.com/log/nginx-error.log;

      # Main location
      location / {
      proxy_pass http://127.0.0.1:8080/;
      proxy_redirect off;

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

      client_max_body_size 10m;
      client_body_buffer_size 128k;

      proxy_connect_timeout 90;
      proxy_send_timeout 90;
      proxy_read_timeout 90;

      proxy_buffer_size 4k;
      proxy_buffers 4 32k;
      proxy_busy_buffers_size 64k;
      proxy_temp_file_write_size 64k;


      }

      # Static files location
      location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|d oc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js )$ {
      root /home/public_html/greenandgoldrugby.com/public;
      }
      Quote Originally Posted by apache sites-enabled
      <VirtualHost 127.0.0.1:8080>
      ServerAdmin moses@greenandgoldrugby.com
      ServerName mail.sehwagology.com
      ServerAlias www.sehwagology.com
      DocumentRoot /home/public_html/greenandgoldrugby.com/public
      ErrorLog /home/public_html/greenandgoldrugby.com/log/error.log
      CustomLog /home/public_html/greenandgoldrugby.com/log/access.log combined


      <Location /server-status>
      SetHandler server-status
      Order deny,allow
      Deny from all
      Allow from localhost
      </Location>

      </VirtualHost>
      Quote Originally Posted by webroot/.htaccess
      # BEGIN WPSuperCache
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      AddDefaultCharset UTF-8
      RewriteCond %{REQUEST_URI} !^.*[^/]$
      RewriteCond %{REQUEST_URI} !^.*//.*$
      RewriteCond %{REQUEST_METHOD} !POST
      RewriteCond %{QUERY_STRING} !.*=.*
      RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
      RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
      RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
      RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cell phone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|BlackBerry9500|CUPCAKE|dream|in cognito|webmate).*
      RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew |cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi |keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap |sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*
      RewriteCond %{HTTP:Accept-Encoding} gzip
      RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
      RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz" [L]

      RewriteCond %{REQUEST_URI} !^.*[^/]$
      RewriteCond %{REQUEST_URI} !^.*//.*$
      RewriteCond %{REQUEST_METHOD} !POST
      RewriteCond %{QUERY_STRING} !.*=.*
      RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
      RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
      RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
      RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cell phone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800|BlackBerry9500|CUPCAKE|dream|in cognito|webmate).*
      RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew |cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi |keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap |sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*
      RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
      RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html" [L]
      </IfModule>

      # END WPSuperCache
      Quote Originally Posted by webroot/forum/.htaccess
      RewriteEngine on

      # If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
      RewriteBase /forum/

      #RewriteCond %{REQUEST_FILENAME} -s [OR]
      #RewriteCond %{REQUEST_FILENAME} -l [OR]
      #RewriteCond %{REQUEST_FILENAME} -d

      #RewriteRule ^.*$ - [NC,L]

      # Forum
      RewriteRule ^threads/.* showthread.php [QSA]
      RewriteRule ^forums/.* forumdisplay.php [QSA]
      RewriteRule ^members/.* member.php [QSA]
      RewriteRule ^blogs/.* blog.php [QSA]
      ReWriteRule ^entries/.* entry.php [QSA]

      # Wiki
      RewriteRule ^showwiki.php?title=(.*)$ showwiki/$1 [L,R=301]
      RewriteRule ^showwiki/Articles.*)$ showwiki/$1 [L,R=301]
      RewriteRule ^showwiki/Image.*)$ showwiki/$1 [L,R=301]
      RewriteRule ^showwiki$ showwiki/ [L,QSA,R=301]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^showwiki/(.*)?$ showwiki_proxy.php [L,QSA]



      RewriteCond %{REQUEST_FILENAME} -s [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d

      RewriteRule ^.*$ - [NC,L]

      # MVC
      RewriteCond %{REQUEST_FILENAME} !\.php$
      RewriteRule ^(?.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]


      Everything is working really well, apart from posting in the image namespace. Upon submitting a thread, I am redirected to a nginx 404 page. When I try and view a thread in the image namespace, it has a URL like

      http://www.greenandgoldrugby.com/for...ating+Plan+png

      Clicking on this results in nginx returning a 404, likely as the URL ends in "png". I have set the "Remove the Dot from Image Extensions in URLs?" option to Yes.

      When I rename the thread to somethjing not ending in png, it does show the image. Thanks for any assistance you can provide with this setup.
      Reply With Quote Reply With Quote

    2. August 10, 2010 #2
      pegasus
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      pegasus is offline
      VaultWiki Team
      Join Date
      March 28, 2004
      Location
      New York, NY
      Posts
      2,959
      Blog Entries
      18
      Rep Power
      687
      In your nginx sites-enabled, find:
      Code:
      location ~* ^.+.(jpg|jpeg|gif|png
      Replace with:
      Code:
      location ~* ^.+\.(jpg|jpeg|gif|png
      In regular expressions a dot (.) and a slash-dot (\.) mean two different things (match any character vs. match a period).
      - lead developer for VaultWiki
      Reply With Quote Reply With Quote

    3. August 10, 2010 #3
      Moses
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      Moses is offline
      Junior Member
      Join Date
      November 19, 2009
      Posts
      46
      Rep Power
      203
      Awesome pegasus, I really appreciate this support and you're absolutely correct. It's working great now.

      Only thing, the images we'd already uploaded are not showing anymore now that I've enabled "Remove the Dot from Image Extensions in URLs?"

      Edit: I just rebuilt the image namespace and it's fixed itself. I'm loving this wiki, looking to launch ours later today, we've already got 100 articles from the closed beta
      Last edited by Moses; August 10, 2010 at 8:25 PM.
      Reply With Quote Reply With Quote

    Similar Threads

    1. Nginx troubles
      By JesterP in forum General Discussion
      Replies: 3
      Last Post: April 4, 2012, 9:28 PM
    2. VBullentin with Vaultwiki behind SSL proxy does not save changes
      By lordsilence in forum VaultWiki Questions
      Replies: 9
      Last Post: May 9, 2011, 4:45 AM
    3. nginx rewrite rules
      By SSSlippy in forum VaultWiki Questions
      Replies: 4
      Last Post: July 28, 2010, 9:30 PM
    4. Sub-Domains on nginx
      By Moses in forum VaultWiki Questions
      Replies: 2
      Last Post: February 9, 2010, 6:55 AM

    Tags for this Thread

    any, apache, articles, begin, com, directory, dot, files, forum, forumdisplay, forums, header, home, image, looking, main, members, namespace, other, page, posting, proxy, read, redirect, remove, rewriting, ring, sea, server, show, showthread, things, title, vbulletin

    View Tag Cloud

    Bookmarks

    Bookmarks
    • Submit to Digg Digg
    • Submit to del.icio.us del.icio.us
    • Submit to StumbleUpon StumbleUpon
    • Submit to Google Google

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    • BB code is On
    • Smilies are On
    • [IMG] code is Off
    • [VIDEO] code is
    • HTML code is Off

    Forum Rules

    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 1:03 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.