小编Igo*_*eSS的帖子

使用docker,nginx,php-fpm提供静态文件

我正在使用docker
中的容器,其中有一个来自PHP-FPM,另一个来自Nginx.
但我遇到Nginx服务静态文件(css,js)的问题
返回状态代码:404 Not Found

Nginx配置

server {
  # Set the port to listen on and the server name
  listen 80;
  listen [::]:80;

  # Set the document root of the project
  root /var/www/html;

  # Set the directory index files
  index index.php;

 #Set server name
 server_name myproject;

  # Specify the default character set
  charset utf-8;

  # Specify the logging configuration
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  # Specify what happens when PHP files are requested
  location ~* \.php$ {
      #try_files $uri =404; …
Run Code Online (Sandbox Code Playgroud)

php containers nginx docker

6
推荐指数
1
解决办法
2211
查看次数

标签 统计

containers ×1

docker ×1

nginx ×1

php ×1