By legihendra7
Hi, im trying to make this work since last 4 days… Can anybody guide me pls.
I have domain xxx.com using a nameserver outside digitalocean.
Through DNS management i create “A Record” of subdomain1.xxx.com and subdomain2.xxx.com pointing to a droplet public IP. The record i created is as follow
subdomain1.xxx.com A 14400 dropletipv4
www.subdomain1.xxx.com A 14400 dropletipv4
subdomain2.xxx.com A 14400 dropletipv4
www.subdomain2.xxx.com A 14400 dropletipv4
the first app is a laravel app, which will be access through subdomain1.xxx.com. it runs on LAMP. i can make this things work just fine, when i open subdomain1.xxx.com the browser shows the correct app.
the 2nd app is a vue js app, which will be access through subdomain2.xxx.com. i create a nginx server block and using this config to guide the subdomain2.xxx.com to the folder containing the 2nd app. At the path /etc/nginx/sites-available/app2 i have nginx config as follow :
server {
listen 80;
listen [::]:80;
server_name subdomain2.xxx.com www.subdomain2.xxx.com;
root /var/www/app2;
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;
proxy_cache_bypass $http_upgrade;
}
}
The problem is, whenever i open subdomain2.xxx.com the browser keep showing the first app.
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!
Hi @legihendra7,
You’ll need to create a separate Nginx configuration file for your subdomain not use the same config.
Additionally, I can see you have proxy_pass http://localhost:8080; in your config which means you are parsing it to Apache, correct? Have you created the vhost configuration there as well or are you gonna use nodejs for your Vue App?
Regards, KFSys
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.