3个容器分别装nginx,mysql,和php运行环境,
访问首页能看到内容,但是css、js、图片全都404了
php环境的日志如下:
72.18.0.4 - 04/Sep/2020:07:15:49 +0000 "GET /index.php" 200
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
172.18.0.4 - 04/Sep/2020:07:15:50 +0000 "GET /index.php" 404
本人是php小白,为什么nginx过来的静态文件请求被nginx全都转成index.php了?
感觉应该是nginx的配置问题,但是conf文件是按照作者大大的教程抄来的,如下:
upstream demo.tipask2.cc {
server 172.18.0.4:80;
}
server {
listen 80;
server_name demo.tipask2.cc; #配置的站点域名,根据实际域名自行调整
set $domain public;
set $project_root /var/www/html;
charset utf-8;
#access_log /home/wwwroot/tipask/storage/tipask.access.log combined; #需要查看访问日志的可以去掉注释
#error_log /home/wwwroot/tipask/storage/tipask.error.log error;#需要查看错误日志的可以去掉注释
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?$1 last;
}
location / {
root $project_root/$domain;
index index.php index.html;
try_files $uri $uri/ /index.php$is_args$query_string;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass tipask-app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $project_root/$domain$fastcgi_script_name;
include fastcgi_params;
}
}
求高手给点建议,可能是什么原因