How to define nginx code for per Domain?

redscience

Registered
Dec 11, 2018
1
0
1
london
cPanel Access Level
Root Administrator
my /etc/nginx/nginx.conf code is :

Code:
server {
.....
location / {
root /var/www/public_folder;
index index.php index.html index.htm;
}
.
.
.
}
------------------------------------------------------------------------------------------------------------------------------------
and my created Domain config file is:
nano /etc/nginx/sites-available/definedname.com

Code:
server { 

listen 80 default; 
listen 443 http2 default_server; 
listen [::]:443 http2 default_server; 

server_name definedname.com www.definedname.com; 
root /var/www/public_folder/definedname.com/$host; 

..... 
}
------------------------------------------------------------------------------------------------------------------------------------



when I want to go to my first page, I see global configuration index.html text, who defined within the global configuration route in /etc/nginx/nginx.conf , this text show in my domain first page

What is my mistake exactly?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello @redscience,

Are you using a specific third-party plugin for Nginx or is this something you've manually configured on your own? If you've setup Nginx on your own, you could look at how other Nginx plugins handle the Apache ports to get a better idea of how to approach the issue. For example, the apache_change_port function on the following third-party Nginx plugin might help:

engintron/engintron

Thank you.