You are not logged in.

#1 2021-05-13 08:51:29

iZiboi
Member
Registered: 2021-03-08
Posts: 3

[SOLVED] [nginx] config "File not found." /home/user

Hello World!

I have created user "arch". For arch user i want to setup a website in user home directory "/home/arch/website.com/html"

Here is my website.com.conf nginx config file:

server {
    listen  80;
    server_name website.com www.website.com;
    root  /home/arch/website.com/html;
    index  index.html index.htm index.php;
    access_log   /home/arch/website.com/log/website.com.log combined;
    error_log   /home/arch/website.com/log/website.com.error.log error;

    location / {

        try_files $uri $uri/ /index.php?$args;

         location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ \.php$ {
            root /home/arch/website.com/html;
            fastcgi_pass   unix:/run/php-fpm7/php-fpm-website.sock;
            fastcgi_index  index.php;
	    include        /etc/nginx/fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/share/nginx/html;
    }
}

nginx.conf config file:

worker_processes  auto;
error_log	  /var/log/nginx/error.log crit;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

  server {
      listen       80;
      server_name  localhost;

      location / {
          root   /usr/share/nginx/html;
          index  index.html index.htm;
      }

      location /phpmyadmin {
              rewrite ^/* /phpMyAdmin last;
      }

      location /phpMyAdmin {
              root /usr/share/nginx/html;
              index index index.html index.htm index.php;
      }

      location ~ \.php$ {
          root           /usr/share/nginx/html;
          fastcgi_pass   unix:/run/php-fpm7/php-fpm.sock;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include        fastcgi_params;
      }
  }
  
include /etc/nginx/sites-enabled/*.conf;
types_hash_max_size 4096;
server_names_hash_bucket_size 64;

}

For some reason it doesn't work

curl -l "https://website.com"
File not found.

But, if i change root location for website to "/var/www/website.com/html" then everything works correct.

I want to understand why it doesn't work in /home/arch but works in /var/www ?!

Thank you!

Last edited by iZiboi (2021-05-13 09:27:57)

Offline

#2 2021-05-13 09:27:25

iZiboi
Member
Registered: 2021-03-08
Posts: 3

Re: [SOLVED] [nginx] config "File not found." /home/user

I'm an idiot. There was a permission issues. It's all good now.

Offline

Board footer

Powered by FluxBB