- Hands-On Full Stack Web Development with Angular 6 and Laravel 5
- Fernando Monteiro
- 168字
- 2021-07-23 19:18:56
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.
推薦閱讀
- 物聯網與北斗應用
- RCNP實驗指南:構建高級的路由互聯網絡(BARI)
- 電子政務效益的經濟分析與評價
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- Web Application Development with R Using Shiny
- 物聯網關鍵技術及應用
- HTML5 Game development with ImpactJS
- Spring Cloud微服務架構進階
- 雷達饋線技術
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- Working with Legacy Systems
- 光纖通信系統與網絡(修訂版)
- Master Apache JMeter:From Load Testing to DevOps
- 從實踐中學習手機抓包與數據分析
- 5G時代的大數據技術架構和關鍵技術詳解