Skip to content

Instantly share code, notes, and snippets.

@flaudanum
Created September 12, 2019 11:56
Show Gist options
  • Save flaudanum/33d70634ebc5797d24da22853a295576 to your computer and use it in GitHub Desktop.
Save flaudanum/33d70634ebc5797d24da22853a295576 to your computer and use it in GitHub Desktop.
NginX - Location with a root that differs from the default one
server {
# Listening to port 80 (default port for HTTP protocol)
listen 80 default_server;
listen [::]:80 default_server;
# Default local root path for web resources
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location /opteasoft-core-docs/ {
# This root differs from the default /var/www/html
root /data/www/;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# Default location
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment