Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx Help me config nginx setting for some uri with file name

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by babyshark, Jan 26, 2019.

  1. babyshark

    babyshark New Member

    20
    5
    3
    Jan 22, 2019
    Ratings:
    +7
    Local Time:
    10:16 PM
    Hi,

    I run laravel site in centminmod server, all thing is perfect, but got some problem

    my nginx domain config file

    location / {
    try_files $uri $uri/ /index.php?$query_string;
    include /usr/local/nginx/conf/503include-only.conf;
    }

    almost url work ok, but some url with file ext show error 404
    (failed (2: No such file or directory)

    ex:
    https://mydomain/link/anytext.rar
    https://mydomain/link/anytext.gif
    https://mydomain/link/anytext.wav
    https://mydomain/link/anytext.mp3
    https://mydomain/link/anytext.gz
    ....................................

    old server (not install cenminmod) work ok with these url

    can help me find what's wrong in this case.

    thank very much

    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit ?
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.15.3
    • PHP Version Installed: 7.2.9
    • MariaDB MySQL Version Installed: i.e. 10.0.x or 10.1.xx or 10.2.xx
     
  2. babyshark

    babyshark New Member

    20
    5
    3
    Jan 22, 2019
    Ratings:
    +7
    Local Time:
    10:16 PM
    Hi, I found the solution here:
    404 not found permalink error on wordpress

    but location ~* match all path in my domain,

    can I hold old config for static file but except some location like: mydomain.com/link/ ?

    thanks
     
  3. eva2000

    eva2000 Administrator Staff Member

    45,728
    10,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,112
    Local Time:
    1:16 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)
     
  4. babyshark

    babyshark New Member

    20
    5
    3
    Jan 22, 2019
    Ratings:
    +7
    Local Time:
    10:16 PM
    Hi eva2000,
    problem fixed by edit /usr/local/nginx/conf/staticfiles.conf

    thanks
     
  5. eva2000

    eva2000 Administrator Staff Member

    45,728
    10,382
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,112
    Local Time:
    1:16 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Glad to hear :)