My server has 2 sites setup using nginx. Below are the content in /etc/nginx/mysite1.conf
server {
listen 80;
server_name test.mysite1.com;
#access_log logs/host.access.log main;
location / {
root /var/www/mysite1;
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/mysite1;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/php-fpm-mysite1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
The content of /etc/php-fpm.d/mysite1.conf is below
[mysite1]
user = nginx
group = nginx
listen = /run/php-fpm/php-fpm-mysite1.sock
listen.owner = nginx
listen.group = nginx
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.status_path = /status
The configuration for mysite2 is exactly the same (except for replacing mysite1 with mysite2). When both nginx my php-fpm is started, both sites work. But any time a php file in site2 is accessed, it goes to the same place of site 1. for example, when i access http://test.mysite2.com/tester.php it shows http://test.mysite1.com/tester.php .
Notes:
- The server block in /etc/nginx.conf is commented out
- All permissions have been set so nginx user can rwx to all /var/www directories and SELinux has been disabled.
- OS : CentOS 7
- ps -ef shows that processes with the mysite1 and mysite2 names are started when php-fpm is run
- though I've added /status to the php-fpm config it doesn't work for either site
- no error logs are shown (should there be? there is no exact error massage or anything for this)
Any help or suggestions are greatly appreciated.