Last active
January 19, 2017 08:18
-
-
Save wuliupo/773613f18155c9f50f9dbf48d18ff5e2 to your computer and use it in GitHub Desktop.
ProxyPass dynamic html to Node.js by Apache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache httpd config | |
# defined: Include conf/extra/local-www-httpd.conf; | |
# location: conf/extra/local-www-httpd.conf; | |
<VirtualHost www.test-local.com:80> | |
DocumentRoot D:/test-local | |
ServerName www.test-local.com | |
ServerAlias test-local.com | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^test-local.com/$ [NC] | |
RewriteRule ^(.*)$ http://www.test-local.com/$1 [R=301,L] | |
<Directory /> | |
AllowOverride None | |
</Directory> | |
<Directory /test-local> | |
AllowOverride All | |
Require all granted | |
Options Indexes FollowSymLinks | |
</Directory> | |
ProxyPassMatch ^(/.*\.html)$ http://127.0.0.1:16003/$1 | |
<Location "/"> | |
Order deny,allow | |
Allow from all | |
</Location> | |
</VirtualHost> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx config | |
# defined: include vhost/*.conf; | |
# location: vhost/test-local.conf; | |
server { | |
listen 80; | |
server_name www.test-local.com test-local.com; | |
root D:\test-local; | |
index index.html; | |
if ($http_host !~ "^www.test-local.com$") { | |
rewrite ^(.*) http://www.test-local.com$1 permanent; | |
} | |
location / { | |
rewrite ^/$ /index.html last; | |
} | |
location ~* \.(html?)$ { | |
proxy_pass http://127.0.0.1:3000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/anonymous/9f8c0c8e53b589ae33c63fad575d95a4