官术网_书友最值得收藏!

Configuring nginx

Now, it's time to create the configuration files for the nginx and php-fpm servers, so we will be using the nginx reverse proxy to serve our PHP files to the web.

Inside the nginx folder, create a new file called nginx.conf and add the following code:

server {
listen 80 default;
client_max_body_size 308M;
access_log /var/log/nginx/application.access.log;
root /application/public;
index index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
location ~ \.php$ {
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE
"error_log=/var/log/nginx/application_php_errors.log";
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
include fastcgi_params;
}
}

The previous file set port 80 as the default port for our web server and set port 9000 to php-fpm, which means that our containers in nginx will communicate with php-fpm through port 9000, and, for communicating with the web, will use the public view through port 80. Later on, in docker-compose.yml, we will configure the internal Docker container ports to the outside world, which, in this case, is our host machine.

主站蜘蛛池模板: 孟津县| 翼城县| 锦屏县| 谢通门县| 和静县| 澄江县| 泰和县| 乌兰县| 利川市| 潞城市| 广州市| 潜江市| 密云县| 金门县| 通道| 江都市| 赫章县| 高安市| 页游| 乐陵市| 鹤庆县| 沙坪坝区| 北海市| 南城县| 桐庐县| 永福县| 舞阳县| 连平县| 茂名市| 长寿区| 繁昌县| 卫辉市| 寿光市| 平凉市| 易门县| 东阿县| 杭锦旗| 峨边| 札达县| 瓮安县| 逊克县|