dnmp精讲二(NGINX与PHP实现通信配置)
第一讲文档地址:https://github.com/bruceqiq/code_study
视频素材:
文档地址:https://github.com/bruceqiq/code_study
仓库地址:https://github.com/bruceqiq/php_dnmp
相关代码:
默认服务
一、 默认dnmp环境下面存在一个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;
    }
}
二、 访问默认域名
http://127.0.0.1
配置虚拟域名
一、 在conf.d目录下面创建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;
  }
}
评论
