1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Location directive is not working correctly nginx

Discussion in 'Site & Server Administration' started by calanon, Jan 30, 2020.

  1. #1
    I am trying to open the location of my index.php file for example:

    The root folder is:

    /path/to/my/root/folder
    Code (markup):
    The the url a user will use to get to this root folder is:

    https://sub.mydomain.net/server/client
    Code (markup):
    Every time I use this location declaration I get a 404 or forbidden message


    location /server/client/ {
              alias /path/to/my/root/folder;
              try_files $uri $uri/ /index.php$uri$is_args$args;
           }
    Code (markup):
    I just cannot work out what I am doing wrong.

    Of course the index.php is located here:

       /path/to/my/root/folder/index.php
    Code (markup):
    Just for clarification I have declared the following also:

     index index.html index.php;
       
        location ~ \.php$ {
              include conf.d/services/php7.conf;
           }
    Code (markup):
    Like I said I just cannot work out what is wrong?
    SEMrush
     
    calanon, Jan 30, 2020 IP
    SEMrush
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    228
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    If you want nginx to serve the index.php file only, you can try with the following configuration:

    location /server/client/ {
        alias /path/to/my/root/folder/index.php;
    }
    Code (markup):
    If you are still getting an error message, check the error log for more details.
     
    RoseHosting, Feb 7, 2020 IP