我正在尝试在AWS Linux上configurationnginx 。 我可以得到它为一个网站的工作,但是当我尝试添加另一个我不断收到以下错误:
nginx: [crit] pread() "/home/ec2-user/public/sites/example.com" failed (21: Is a directory)
这是我的nginx.conf :
user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { 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; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; include /home/ec2-user/public/sites/*; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; index index.html index.htm; server { listen 80 default_server; listen [::]:80 default_server; server_name localhost example.es www.example.es; root /home/ec2-user/public/sites/es-example; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } server { listen 80; listen [::]:80; server_name example.com www.example.com; root /home/ec2-user/public/sites/en-example; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
example.com和example.es都有一个index.html 。 这两个目录的权限如下。
-rwxr-xr-x 1 ec2-user ec2-user
有任何想法吗? 谢谢!
问题在于这一行:
include /home/ec2-user/public/sites/*;
上面的指令被nginx用来加载/包含额外的configuration选项。 只有正确的nginxconfiguration文件应该放在下面
/home/ec2-user/public/sites/
如果你在那里放置目录或站点(内容)文件,nginx将不能包含它们。 请检查nginx文档