dnmp精讲二(NGINX与PHP实现通信配置)

卡二条的技术圈

共 1948字,需浏览 4分钟

 · 2021-09-17

dnmp精讲一(docker搭建与容器管理)

第一讲文档地址: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;
  }
}


浏览 78
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报