I installed nginx on a debian server. I have three servers (virtual hosts):
- default (/etc/nginx/sites-enabled/0-default)
- mydomain.com (/etc/nginx/sites-enabled/1-mydomain)
- booking.mydomain.com (/etc/nginx/sites-enabled/2-booking)
When I access to the server with its domain names, I get the right websites. But when I access to the server with its IP address, it's the booking website that is returned.
This booking website is on Symfony, here is the content of the sites-enabled/2-booking file:
server {
server_name booking.mydomain.com;
root /var/www/booking/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
limit_req zone=one burst=20;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
error_log /var/log/nginx/booking_error.log;
access_log /var/log/nginx/booking_access.log;
}
I want my server to return the /var/www/index.php file when it is accessed from its IP address, do you have an idea of what to do ?