nginx config multiple server with ssl my server_name example.com read root from server_name admin.example.com
code
server {
listen 80;
listen 433 ssl;
ssl on;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name example.com www.example.com;
root /var/www/html/example/dist;
location / {
try_files $uri $uri/ /index.html;
}
}
server {
listen 80;
listen 433 ssl;
ssl on;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name admin.example.com www.admin.example.com;
root /var/www/html/admin-example/dist;
location / {
try_files $uri $uri/ /index.html;
}
}
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 @uniicoth,
I’m not sure I understand the question exactly. Do you want to make your domain.com to read files from another folder like root /var/www/html/admin-example/dist?
If that’s the case, you can just the root of your website at /var/www/html/ just like
root /var/www/html/
And then using location blocks load anything you need to load from different directories.
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.