Estou usando docker em um projeto de PHP que estou estudando.
Porém, pelo docker o css não carrega.
Aparece o css no debug mas como se fosse a index.
Meu Dockerfile:
image
FROM php:7.1-fpm
install required PHP extensions
RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libpng12-dev
libpq-dev
g++
libicu-dev
libxml2-dev
git
vim
libfreetype6-dev
libjpeg62-turbo-dev
libmcrypt-dev
libpng12-dev
libmagickwand-dev --no-install-recommends
libmemcached-dev
&& docker-php-ext-configure intl
&& docker-php-ext-install mbstring
&& docker-php-ext-install intl
&& docker-php-ext-install zip
&& docker-php-ext-install pdo
&& docker-php-ext-install pdo_mysql
&& docker-php-ext-install pdo_pgsql
&& docker-php-ext-install soap
&& docker-php-ext-install -j$(nproc) iconv mcrypt
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
&& docker-php-ext-install -j$(nproc) gd
&& docker-php-ext-install opcache
&& docker-php-ext-install mysqli
&& pecl install imagick
&& docker-php-ext-enable imagick
&& pecl install apcu
&& docker-php-ext-enable apcu
&& pecl install xdebug
&& apt-get purge --auto-remove -y g++
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*
install composer
RUN curl -sS https://getcomposer.org/installer | php – --install-dir=/usr/local/bin --filename=composer
document root
WORKDIR /var/www/html
default.conf:
server {
# Set the port to listen on and the server name
listen 80 default_server;
server_name app;
# Set the document root of the project
root /usr/share/nginx/html/www;
# Set the directory index files
index index.php index.htm index.html;
# Specify the default character set
charset utf-8;
# Setup the default location configuration
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Specify the details of favicon.ico
location = /favicon.ico { access_log off; log_not_found off; }
# Specify the details of robots.txt
location = /robots.txt { access_log off; log_not_found off; }
# Specify the logging configuration
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile off;
client_max_body_size 100m;
# Specify what happens when PHP files are requested
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION_ENV development;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
# Specify what happens what .ht files are requested
location ~ /\.ht {
deny all;
}
}
php.ini:
; cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for CGI. PHP’s
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo = 0;
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone = Asia/Tokyo
; error reporing
display_errors = On
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 25M
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 20M
docker-compose.yml:
version: “2”
services:
mysql:
image: mysql:latest
ports:
- "3307:3306"
expose:
- 3306
volumes:
- ./docker/mysql/data/:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_DATABASE: loja
php:
build: ./docker/
ports:
- "9000:9000"
links:
- mysql
volumes:
- ./www:/usr/share/nginx/html/www
- ./docker/php.ini:/usr/local/etc/php/php.ini
nginx:
image: nginx:latest
links:
- php
ports:
- "8088:80"
volumes:
- ./docker/nginx/log/:/var/log/nginx/
- ./docker/default.conf:/etc/nginx/conf.d/default.conf