Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to define nginx code for per Domain?

Discussion in 'Workarounds and Optimization' started by redscience, Dec 11, 2018.

Tags:
  1. redscience

    redscience Registered

    Joined:
    Dec 11, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,272
    Likes Received:
    2,154
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice