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

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.

主站蜘蛛池模板: 广汉市| 元谋县| 芷江| 彝良县| 青川县| 高邮市| 南开区| 米脂县| 靖宇县| 杂多县| 长葛市| 天气| 荣昌县| 尚志市| 武鸣县| 阿勒泰市| 探索| 鲁甸县| 吴堡县| 阆中市| 柏乡县| 石渠县| 迁安市| 湖北省| 玛沁县| 麻阳| 布尔津县| 晋州市| 乌兰察布市| 宝丰县| 茶陵县| 四会市| 孝昌县| 双峰县| 社旗县| 兴和县| 杂多县| 措美县| 贺兰县| 南木林县| 乌什县|