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!
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.
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
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.