环境:
Ubuntu 17.10 (虚拟机)
PHP 7.1
Nginx 1.12.1
今天安装了三遍, 试了composer, 也试了直接copy安装包到目录都不行.
PHP要求的包也用php -m
查看了, 都有.
结果是: 访问网站根目录403, admin是502
这是访问一次根目录的完整请求:
2017/12/21 16:55:49 [error] 646#646: *1 directory index of "/home/kk/aa/" is forbidden, client: 172.16.62.1, server: , request: "GET / HTTP/1.1", host: "172.16.62.130:8088"
2017/12/21 16:55:49 [crit] 646#646: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 172.16.62.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "172.16.62.130:8088", referrer: "http://172.16.62.130:8088/"
我去官方论坛看了, 说有可能是文件夹权限的问题, 但是我的文件夹是0775的了已经:
➜ ~ stat aa
File: aa
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 274177 Links: 6
Access: (0775/drwxrwxr-x) Uid: ( 1000/ kk) Gid: ( 1000/ kk)
Access: 2017-12-21 16:38:30.978382988 +0800
Modify: 2017-12-21 16:33:12.236461193 +0800
Change: 2017-12-21 16:33:12.236461193 +0800
Birth: -
附上我的Nginx的配置文件:
user kk kk;
worker_processes 1;
worker_rlimit_nofile 8192;
events {
worker_connections 1024;
}
http {
server {
listen 8088;
root /home/kk/aa;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /api {
try_files $uri $uri/ /api.php?$query_string;
}
location /admin {
try_files $uri $uri/ /admin.php?$query_string;
}
location /flarum {
deny all;
return 404;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}
}
谢谢大家帮忙!