Created
October 4, 2012 16:44
-
-
Save koenpunt/3834852 to your computer and use it in GitHub Desktop.
Using Nginx as SSL Proxy for Name Based VirtualHosts in 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
server { | |
listen 443 ssl; | |
server_name ~^(www\.)?(?<domain>.+)$; | |
# It's possible to configure Nginx to serve static files directly, and | |
# bypassing Apache but I won't describe that here. | |
root /var/apps/$domain/current/public; | |
ssl_certificate /etc/ssl/certs/cmpgns/STAR_cmpgns_nl.crt; | |
ssl_certificate_key /etc/ssl/private/STAR_cmpgns_nl.key; | |
location / { | |
# Apache is listening here | |
proxy_pass http://127.0.0.1:80; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# Set HTTPS flag for mod_rpaf | |
proxy_set_header X-Forwarded-HTTPS on; | |
} | |
} |
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
RPAF_Enable On | |
RPAF_ProxyIPs 127.0.0.1 | |
RPAF_SetHostName On | |
RPAF_SetHTTPS On | |
RPAF_SetPort On |
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
<VirtualHost 127.0.0.1:80> | |
ServerName some-subdomain.cmpgns.nl | |
DocumentRoot "/var/apps/some-subdomain.cmpgns.nl/current/public" | |
RewriteEngine on | |
<Directory "/var/apps/some-subdomain.cmpgns.nl/current/public"> | |
Allow from all | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment