无法使index.php页面显示在Docker容器中

时间:2019-02-06 04:42:33

标签: php docker nginx

我有一个设置为显示php页面的docker容器,但是它显示了403禁止页面。我的主机上正在运行Nginx,并且也启用了我的站点。该网站显示的是html文件,而不是php文件。我还验证了以下服务正在运行。

  1. nginx在docker容器中运行
  2. php-fpm服务正在docker容器中运行。
  3. 用户www-data有权执行文件夹中的文件

    server {
      listen 443;
      server_name af.oxygenweb.ca;


      ssl_certificate /etc/letsencrypt/live/af.oxygenweb.ca/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/af.oxygenweb.ca/privkey.pem;

      ssl_stapling on;
      ssl_stapling_verify on;


      location /.well-known {
         alias /var/www/html/.well-known;
      }


      access_log   /var/log/nginx/af/access.log;
      error_log    /var/log/nginx/af/error.log;

      location / {
        root /var/www/html;
        index index.php;
        proxy_pass http://172.17.0.2;
        proxy_redirect http:// https://;
        proxy_connect_timeout 300s;
        proxy_read_timeout 300s;
        #try_files $uri /index.html index.php;
      }

      # pass PHP scripts to FastCGI server

      location ~* \.php$ {
          # include snippets/fastcgi-php.conf;
          # pass PHP scripts to FastCGI server
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        include         fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
      }
    }

0 个答案:

没有答案