server {
  listen 80;
  server_name www.local.test;
  root /data/workspace; 
  index index.php index.html index.htm;

  error_page 404 502 503 =200 /index.html;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9000;
    #fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    try_files $uri =404;
  }

  location ~ /\.(ht|svn|git) {
    deny all;
  }
}

  • fastcgi_pass  #用来指定php-fpm监听的地址或者socket
  • fastcgi_index index.php  #设定访问根目录默认去找的文件
  • fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name  #设置访问根目录时默认寻找的文件

修改完成后

测试nginx配置是否正确: /usr/local/nginx/sbin/nginx -t

平滑重启nginx服务: /usr/local/nginx/sbin/nginx -s reload

Ngnix配置的更多相关文章

  1. ngnix配置自解

    全局配置 user [user] [group]; #只有被设置为用户或用户组的成员才有nginx的启动权限.(#user nobody nobody <=> user nobody no ...

  2. ngnix 配置CI框架 与 CI的简单使用

    ngnix 支持 CI框架1.修改config.php 参考网址:https://www.chenyudong.com/archives/codeigniter-in-nginx-and-url-re ...

  3. ngnix 配置

    #运行用户 user www-data;     #启动进程,通常设置成和cpu的数量相等 worker_processes  1; #全局错误日志及PID文件 error_log  /var/log ...

  4. vue router history模式开发ngnix配置

    一.前沿 现在很多用vue-router开发页面的时候,都习惯使用hash路由莫模式,如:https://xxxx/#/index/share?code=dsfsd.这种模式在做pc端开发时候挺好用的 ...

  5. php 镜像richarvey/nginx-php-fpm的ngnix配置

    1.遇到错误option error_page 405 =200 $request_uri; location ~ ^/(json)/ { # root /data/website/xxxx.com/ ...

  6. ngnix配置thinkphp5隐藏index.php的方法亲测有效

    在需要访问的域名的conf文件中,比如 vim /etc/nginx/.com.conf location / { // …..省略部分代码 if (!-e $request_filename) { ...

  7. 我的ngnix 配置内容

    #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #erro ...

  8. 基于windows的ngnix基础使用

    前言 今天组长一大早心血来潮的跟我说,我希望我们小组电脑做web站点的服务器集群,你搞一搞,就用ngnix吧. 君要臣死,臣不得不死.顺便写个文章做个笔记. 简介 Nginx 是一个高性能的HTTP和 ...

  9. HAProxy、Nginx 配置 HTTP/2 完整指南

    基于最近对HTTP/2的争论和它的优势,是时候升级底层架构了.这篇文章将会介绍如何在安装和配置HAProxy和Ngnix(使用ssl终端).为了简化流程,我建议你准备好使用Docker镜像. 如果你想 ...

随机推荐

  1. selenium+python爬虫环境搭建

    前言: 准备使用selenium爬取网站数据,先搭建selenium+python爬虫环境搭建 系统环境: 64位win10系统,同时装python2.7和python3.6两个版本,IDE为pych ...

  2. STM32手记

    20k的ram,64k的Flash 2.3.7: 复位,内部8MHz工作. 外部时钟出错时,自动切换到内部RC时钟,可设置该中断,PLL同样能监测. 高速时钟最大72M,低速时钟,最大36M. 2.3 ...

  3. Ecplise通过Git将项目提交到GitHub

    一.参考https://blog.csdn.net/bendanany/article/details/78891804 二.注意点: 1.仓库名必须和项目名相同: 2.若提交出现Can't conn ...

  4. 【UML】NO.53.EBook.6.UML.2.001-【Thinking In UML 大象 第二版】- 概述

    1.0.0 Summary Tittle:[UML]NO.53.EBook.6.UML.2.001-[Thinking In UML 大象 第二版]- 概述 Style:DesignPattern S ...

  5. Android签名文件转化为pk8和pem来对apk重签名

    当我们需要修改已经打包好的apk中的某个文件时,比如改下图标,我们势必要采用反编译apk,改文件,重编译apk,重签名才行,参考:https://www.cnblogs.com/zndxall/p/9 ...

  6. MySQL AUTO_INCREMENT 学习总结

    之前有碰到过开发同事指出一张InnoDB表的自增列 AUTO_INCREMENT 值莫明的变大,由于这张表是通过mysqldump导出导入的. 问题排查: 1.首先,查看表表义的sql部分的 auto ...

  7. pandas处理时间序列(1):pd.Timestamp()、pd.Timedelta()、pd.datetime( )、 pd.Period()、pd.to_timestamp()、datetime.strftime()、pd.to_datetime( )、pd.to_period()

      Pandas库是处理时间序列的利器,pandas有着强大的日期数据处理功能,可以按日期筛选数据.按日期显示数据.按日期统计数据.   pandas的实际类型主要分为: timestamp(时间戳) ...

  8. php判断手机段登录,以及phpcms手机PC双模板调用

    首先一段php代码判断是否为手机浏览: function isMobile() { // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset ($_SERVER['HTTP ...

  9. 查询oracle数据字典,并对应出hive的数据类型

    SQL开始 select t2.owner||'.'||t2.TABLE_NAME 源表名, 'dl_{0}_seq.'||'tt_{1}_'||lower(t2.table_name) hive表名 ...

  10. C++ Const指针