Hello. I’m a bit new to this. I have a droplet of ruby application. Ubuntu 12.1, nginx + unicorn. I want to create a subdomain that calls for a different directory.
domain.net -> /home/rails sub.domain.net -> /var/www/sub/public_html
I’ve followed these two tutorial: https://www.digitalocean.com/community/articles/how-to-set-up-and-test-dns-subdomains-with-digitalocean-s-dns-panel https://digitalocean.com/community/articles/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts
My zone file is: @ IN A xxx.xxx.xxx.xxx blog IN A xxx.xxx.xxx.xxx
My “default” nginx file is: server { listen 80; root /home/rails/public; server_name www.domain.net domain.net; index index.htm index.html;
location / {
try_files $uri/index.html $uri.html $uri @app;
}
location ~* ^.+.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ { try_files $uri @app; }
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
and my “sub.domain.net” file is: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
root /var/www/blog/public_html;
index index.html index.htm index.php;
server_name blog.minhn.net;
location / {
try_files $uri $uri/ =404;
}
}
Both have symbolic links in /etc/nginx/sites-enabled However if I go to sub.domain.net it shows domain.net content. I’m not sure what I’m missing.
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello. Yes I did restart nginx. <br>Here is the pastebin for that command <br>http://pastebin.com/1EwqZd2N
Also here’s the pastebin for uneditted nginx files <br>default: http://pastebin.com/jKkDUsKh <br>blog.minhn.net: http://pastebin.com/dSDPLVC8 <br>Thanks.
The ls command returns: <br>/etc/nginx/sites-available/blog.minhn.net <br> <br>if I remove the default link under sites-enabled with <br>sudo rm /etc/nginx/sites-enabled/default <br>then everything points to the blog, even minhn.net <br> <br>should I rename “default” file into “minhn.net”? <br> <br>Thanks. <br>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.