Last active
December 24, 2015 12:09
-
-
Save johnnyt/6795874 to your computer and use it in GitHub Desktop.
NGINX try_files 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
# Install NGINX | |
sudo apt-get install nginx | |
# Rename github repository to ads_archive | |
# Create new github repository named ads | |
REPO_URL="https://github.com/mediaFORGE/ads.git" | |
ADS_DIR=/mnt/tmp # ?? | |
ADS_ARCHIVE_DIR=/mnt/ads_archive | |
# Move current ads directory to new frozen directory - it will never be updated again | |
sudo mv $ADS_DIR $ADS_ARCHIVE_DIR | |
# Checkout the new ads repo to current location | |
sudo git clone $REPO_URL $ADS_DIR |
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 4949; | |
root /mnt/new_ads; | |
index index.html index.htm; | |
# Serve static content from the new repo | |
# Proxy everything else to Apache | |
location / { | |
try_files $uri $uri/ @apache; | |
} | |
location @apache { | |
proxy_pass http://127.0.0.1:81; | |
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; | |
} | |
} |
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 4949; | |
root /mnt/new_ads; | |
index index.html index.htm; | |
# Serve static content from the new and archive repos | |
location / { | |
try_files $uri $uri/ /archive/$uri /archive/$uri/; | |
} | |
# Proxy only php files to Apache | |
location ~ \.php$ { | |
proxy_pass http://127.0.0.1:81; | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment