By Pera
Hi, I’ve got a working server running nginx with the site information below
server { listen 80; listen [::]:80;
root /var/www/app1/public;
index index.php;
server_name 12.23.456.789;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
server { listen 8080; listen [::]:8080;
root /var/www/app2/public;
index index.php;
server_name 12.23.456.789;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Unfortunately I can not manage the get the same working setup in DigitalOcean Droplet… Any ideas might might be the case or what am I missing? Just getting errors about conflicting server name
conflicting server name “12.23.456.789” on 0.0.0.0:80, ignored conflicting server name “12.23.456.789” on [::]:80, ignored conflicting server name “12.23.456.789” on 0.0.0.0:8080, ignored conflicting server name “12.23.456.789” on [::]:8080, ignored
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!
Find a fix (at least a temporary one). I’m using a floating ip as the other servername. Seems to work…
EDIT: The config you copy/pasted above should actually work. There must be duplicate copies of your config, basically a place where you are defining a server block with the same server_name and port twice.
Take a look at this tutorial for complete context on nginx config for multiple sites: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
nginx config would fail with the error conflicting server name if you have multiple server {} blocks with the same PORT and SERVER_NAME lines.
nginx config could be in files in /etc/nginx/sites-enabled/default or in /etc/nginx/conf.d - take a look and confirm that there are no places where you are defining the same port and server_name in two different server{} blocks.
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.