dnmp精講二(NGINX與PHP實(shí)現(xiàn)通信配置)
第一講文檔地址:https://github.com/bruceqiq/code_study
視頻素材:
文檔地址:https://github.com/bruceqiq/code_study
倉庫地址:https://github.com/bruceqiq/php_dnmp
相關(guān)代碼:
默認(rèn)服務(wù)
一、 默認(rèn)dnmp環(huán)境下面存在一個localhost的配置。
server {
listen 80 default;
server_name localhost;
root /www/localhost;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass php:9000;
include fastcgi-php.conf;
include fastcgi_params;
}
}
二、 訪問默認(rèn)域名
http://127.0.0.1
配置虛擬域名
一、 在conf.d目錄下面創(chuàng)建nginx配置文件。
二、 添加NGINX配置。
server {
listen 80;
server_name laravel8.com;
root /www/laravel8/public;
index index.php index.html;
access_log /var/log/nginx/nginx.laravel8.com.access.log main;
error_log /var/log/nginx/nginx.laravel8.com.error.log warn;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php:9000;
include fastcgi-php.conf;
include fastcgi_params;
}
}
評論
圖片
表情
