I am trying to deploy django in centos 8 . I am getting 403 directory forbidden error. I have applied
chmod 755 var/www/
still i am getting this error
I have also applied sudo chown myusername:psaserv /var/www/vhosts/aaa.com but still i am getting this error . This is the error i am getting inside the server logs
2020/10/22 08:15:14 [error] 78481#0: *398 directory index of "/var/www/vhosts/aaa.com/httpdocs/djangoProject/" is forbidden, client: 162.158.167.71, server: aaa.com, request: "GET / HTTP/1.1", host: "aaa.com"
this is my nginx configuration file
#user nginx;
worker_processes 1;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
You may need to just make sure to allow your custom document root to be served as HTTP content. To do so, try running :
chcon -vR system_u:object_r:httpd_sys_content_t:s0 /var/www/vhosts/aaa.com
this one bit me too just the other day =\\
FYI - if you have SELinux installed and running, this is probably also why. You either have to go through the lengthy process of resolving the SELinux problems, disable SELinux, or keep the files in the /usr/share/nginx/html
folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.