Nginx 403

nginx appears
403 Forbidden
nginx/1.10.3

you can sign in the html file. When it is forced to open index.php. It becomes a download.
html folder gives 777. It also indicates that the permissions are insufficient. All kinds of permissions have been given

.

errror.log
01:14:18 on 2018-04-28 [error] 730 directory index of 730: * 4 directory index of "/ var/www/html/" is forbidden, client: 192.168.2.103, server: _, request: "GET / HTTP/1.1", host: "192.168.2.105"

clipboard.png

nginx.conf

user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    -sharp multi_accept on;
}

http {

    -sharp-sharp
    -sharp Basic Settings
    -sharp-sharp

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    -sharp server_tokens off;

    -sharp server_names_hash_bucket_size 64;
    -sharp server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    -sharp-sharp
    -sharp SSL Settings
    -sharp-sharp

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; -sharp Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    -sharp-sharp
    -sharp Logging Settings
    -sharp-sharp

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    -sharp-sharp
    -sharp Gzip Settings
    -sharp-sharp

    gzip on;
    gzip_disable "msie6";

    -sharp gzip_vary on;
    -sharp gzip_proxied any;
    -sharp gzip_comp_level 6;
    -sharp gzip_buffers 16 8k;
    -sharp gzip_http_version 1.1;
    -sharp gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    -sharp-sharp
    -sharp Virtual Host Configs
    -sharp-sharp

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


-sharpmail {
-sharp    -sharp See sample authentication script at:
-sharp    -sharp http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
-sharp 
-sharp    -sharp auth_http localhost/auth.php;
-sharp    -sharp pop3_capabilities "TOP" "USER";
-sharp    -sharp imap_capabilities "IMAP4rev1" "UIDPLUS";
-sharp 
-sharp    server {
-sharp        listen     localhost:110;
-sharp        protocol   pop3;
-sharp        proxy      on;
-sharp    }
-sharp 
-sharp    server {
-sharp        listen     localhost:143;
-sharp        protocol   imap;
-sharp        proxy      on;
-sharp    }
-sharp}

my.conf


server
  {
    listen 80;
    server_name localhost;
    index index.html index.php;
    root /var/www/html/;
      location ~ .*\.(php|php5)?$
    {
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      fastcgi_index index.php;
      include fastcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$
    {
      expires 30d;
  -sharp access_log off;
    }
    location ~ .*\.(js|css)?$
    {
      expires 15d;
   -sharp access_log off;
    }
    access_log off;
  }
Mar.06,2021

nginx is configured. There are two main reasons for Forbidden: 1. Nginx does not have the permission to access the directory; 2. There is no default document in the nginx directory, and there is no permission to list the directory.
nginx.conf post

if you don't have this, just add it. If you have it, just post it and have a look at it

.
-sharp pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
-sharp
location ~ \.php$ {
        // root /var/www/html; -sharpphp
        // fastcgi_pass 127.0.0.1:9000;-sharpphp-fpm9000
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
}

php file is downloaded, indicating that php and nginx are not configured yet

configure it first, and it should be fine.


see that root,nginx is specified by user in the configuration. If root is configured, you need to force the parameter to start, so it is recommended to put the default nobody or create a new www user, or simply delete it and leave it to the default.
is the other one built on this machine? Why is server_name localhost??

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b374e0-2c065.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b374e0-2c065.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?