What needs to be added in configs to execute scripts from directories. At the moment, only from www are launched, if I specify also the directory issues 404.

File contents default

 server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } } 

    1 answer 1

    You did not specify how nginx to work with php files. For this you need php-fastcgi:

    location ~ \.php$ { include snippets/fastcgi-php.conf; include fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME /var/www/html/example.com/public_html$fastcgi_script_name; }

    Also, the default file should not be used as a host file. I advise you to read how to make hosts for Nginx. For example here.

    Nginx + FastCGI configuration example for Ubuntu 16.04