michaelalemu / phurl

Automatically exported from code.google.com/p/phurl
0 stars 0 forks source link

phurl nginx rule #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We use nginx as static content provider and dynamic content proxy, it 
dispatches dynamic content request to apache(listening on port 81, set in 
firewall rules to be localhost available only).
The rule make them work,
nginx rule:
server {
listen       80;
server_name  s.gamepub.cn;

access_log  /usr/tmp/logs/phurl.access.log  main;
location = / {
             rewrite "^/$" /index.php last;
         }
location ^~ /index.php {
try_files $uri $uri/ @php;
}
location ^~ /redirect.php {
try_files $uri $uri/ @php;
}
location ~ ^/([^\.]+)$ {
rewrite "^/(.*)$" /redirect.php?alias=$1 last;
}
location @php {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:81;
}
location / {
expires max;
add_header  Cache-Control  private;
             root /usr/local/www/phurl;
}
}

apache rule:
<VirtualHost *:81>
    ServerAdmin admin@lshai.com
    ServerName s.gamepub.cn
    DocumentRoot "/usr/local/www/phurl"
    ErrorLog "/usr/tmp/logs/phurl_err.log"
    CustomLog "/usr/tmp/logs/phurl_access.log" common
<Directory "/usr/local/www/phurl">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

welcome to our site GamePub , a gamers' micro society. 

Original issue reported on code.google.com by benb88 on 10 Sep 2010 at 12:22

GoogleCodeExporter commented 8 years ago
Awesome, thanks for the info. We'll be getting a decent FAQ soon, so i'll add 
it there when done.

Original comment by hcblahb...@gmail.com on 26 Oct 2010 at 8:55