I've read the docs, scanned examples, and I cannot for the life of me figure out why this isn't working. I'm totally new to nginx, so if this is a stupid simple answer, go easy on me, please.
user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # Virtual Host Configs ## #include /etc/nginx/conf.d/*.conf; #include /etc/nginx/sites-enabled/*; server { listen 80; server_name localhost domain.com; root /home/TMlabs/server_files; index index.html index.htm; location = /othersite { root /home/TMlabs/server_files/location2; index index.html index.htm; } location / { root /home/TMlabs/server_files/location1; index index.html index.htm; } } If I need to include more, let me know and I'll dump the whole nginx.conf. It's pretty basic, though.
All I'm trying to achieve is mapping domain.com to the root specified in location / (which is working) and mapping domain.com/othersite to the root specified in that directive. For some reason, it returns the /home/TMlabs/server_files/location1/index.html document when i navigate to domain.com/othersite rather than the index.html file from the /home/TMlabs/server_files/location2 folder. I've tried removing the equals and using the different operators available for matching, but nothing seems to work. it's probably something pretty basic that I am misunderstanding, being new to this stuff. I also suck at regexp. anyone care to enlighten?
edit: I think what is happening is that it is actually ignoring my directives entirely and is simply using /usr/share/nginx/wwwas the document root. I don't see this config anywhere; what am I missing?