hi there,
I have searched through the Digital Ocean community for this problem that I am having and I was not able to resolve it.
I’m trying to point
app A -> siteA.com dev app A -> dev.siteA.com
what is happening dev app A -> dev.siteA.com app A -> dev.siteA.com
here is my **zone file **
$ORIGIN siteA.com.
$TTL 1800
siteA.com. IN SOA ns1.digitalocean.com. hostmaster.siteA.com. 1460656377 10800 3600 604800 00000
siteA.com. 1800 IN NS ns1.digitalocean.com.
siteA.com. 1800 IN NS ns2.digitalocean.com.
siteA.com. 1800 IN NS ns3.digitalocean.com.
siteA.com. 1800 IN A 000.000.00.00
www.siteA.com. 1800 IN CNAME siteA.com.
siteA.com. 1800 IN MX 10 store1.test.net.
siteA.com. 1800 IN MX 0 smtp.test.net.
dev.siteA.com. 1800 IN CNAME siteA.com.
here is my Nginx setup for siteA
**server_tokens off; # for security-by-obscurity: stop displaying nginx version
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80; # if this is not a default server, remove "default_server"
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
root /home/siteA/bundle/programs/web.browser;
access_log off;
expires max;
}
server_name siteA.com; .
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
here is my Nginx setup for dev.siteA
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80; # if this is not a default server, remove "default_server"
server_name dev.siteA.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# the root path (/) MUST NOT be cached
if ($uri != '/') {
expires 30d;
}
}
}
thank you for reading ;)
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Here’s the tutorial on how to host multiple websites on Nginx securely - https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04
It appears that this is configured correctly but both sites are passing all requests through to the service running on port 8080 on your droplet. For dev.siteA it shows 127.0.0.1:8080 while for siteA you have localhost:8080 - these two addresses point to the same location.