nginx bad request error accessing the web site

server { 
 
 #Nginx should listen on port 80 for requests to yoursite.com
 listen 80; 
 server_name yoursite.com; 

 #Create access and error logs in /var/log/nginx
 access_log /var/log/nginx/yoursite.access_log main; 
 error_log /var/log/nginx/yoursite.error_log info; 

 #Nginx should look in /var/www/yoursite for your website
 root /var/www/yoursite/;
 #The homepage of your website is a file called index.php 
 index index.php; 

 #Specifies that Nginx is looking for .php files
 location ~ \.php$ { 
  #If a file isn’t found, 404
  try_files $uri =404; 
  #Include Nginx’s fastcgi configuration
  include /etc/nginx/fastcgi.conf;
  #Look for the FastCGI Process Manager at this location 
  fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
 } 
}
Thx to https://linuxconfig.org/basic-php-7-and-nginx-configuration-on-ubuntu-16-04-linux

Comments