HostFile Script Page 404 Nginx rewrite

Discussion in 'Installation/Configuration' started by CodePLS, Apr 18, 2021.

  1. CodePLS

    CodePLS New Member

    Hi , i use ispconfig last patch with Nginx rule for my script in /etc/nginx/sites-available/default

    Im not sure if fastcgi work i disable my firewall i use my domain and full path to install my files

    My file when Edit with Vim

    server {
    listen 80;
    server_name mydomain.com; # change this for your server
    root /var/www/clients/client1/web1/web;
    index index.php;
    client_max_body_size 5G;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
    if (!-e $request_filename) { rewrite ^/(.*) /index.php?_page_url=$1 last; }
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    location / {
    if (!-e $request_filename) {
    rewrite ^/(.*) /index.php?_page_url=$1 last;
    }
    }

    location /files/ {
    internal;
    }

    # these locations would be hidden by .htaccess normally
    location /logs/ {
    deny all;
    }
     
  2. CodePLS

    CodePLS New Member

    My Support of this script say its on that code
    I need edit this

    location ~ \.php$ {
    if (!-e $request_filename) { rewrite ^/(.*) /index.php?_page_url=$1 last; }

    }


    When i look error log i have

    48 openat() "/var/www/mydomain.com/web/faq" failed (2: No such file or directory)
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The file /etc/nginx/sites-available/default is not from ISPConfig, it is not an ISPConfig website vhost file. So not sure what you are doing exactly as the content of that file seem to use at least some ispconfig paths, but this does not make much sense to me as such a file should not exist as ispconfig creates it#s own vhost files and also you file seems to connect to a wrong PHP-FPM daemon etc, so it can't work as far as I see.

    Why don't you simply create a website in ISPConfig, copy your cms files into the web directory and add custom nginx directives, if required by your cms, to the nginx directives field of the website in ISPConfig?
     
  4. CodePLS

    CodePLS New Member

    Hi, thanks answer i create my website with panel admin and i transfert my file in /var/www/clients/client1/web1/web;

    Now i need remove this file ? /etc/nginx/sites-available/default

    Im beginner i dont know how edit this rewrite rule in directive field with admin panel :(
     
  5. CodePLS

    CodePLS New Member

    I add now directive in correct place in my admin panel i watch my log error nginx

    "server" directive is not allowed here in /etc/nginx/sites-enabled/900-mydomain.com.vhost:149

    Why its not allowed i use directive field in option ?
     

Share This Page