By italoborges
Hello, I’m new in DO and i’m trying to configure my server for deploy some apps.
I would like to set my DNS in my domain and redirect to my app in DO. And another thing, an app can run Node or PHP.
For example: app1.domain.com -> /home/myuser/www/app1 -> PHP app2.domain.com -> /home/myuser/www/app2 -> NODE app2.domain.com -> /home/myuser/www/app3 -> NODE
First, I installed PHP, Node and Nginx.
How can I modify the Nginx config file to make the redirects?
My Nginx file until now:
server {
server_name app1.domain.com;
root /home/myuser/www/app1;
}
PS: At this time, if i try to enter in my droplet ip (104.XXX.77.XX), i see the app1 html.
I’m thinking of something like this:
server {
server_name app1.domain.com;
root /home/myuser/www/app1;
}
server {
server_name app2.domain.com;
root /home/myuser/www/app2;
}
server {
server_name app3.domain.com;
root /home/myuser/www/app3;
}
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!
This comment has been deleted
you have to use nginx reverse proxy for nodejs app
server {
listen 80;
server_name app2.domain.com;
location / {
proxy_pass http://localhost:{YOUR_NODEJS_PORT};
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;
}
}
This comment has been deleted
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.