1、
/etc/nginx/conf.d/ 下设置一个 default.conf,server_name 设置为 localhost,如果有其他非法域名 A 记录到该机器上,
则返回默认的 Nginx 页面
server {
listen 80;
server_name localhost;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

2、
server {
listen 80;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /var/lib/nginx/html;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}

3、
server {
listen 80;
root /var/www/html;
index index.html index.htm index.php;
server_name _;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /var/lib/nginx/html;
}

location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

default.conf的更多相关文章

  1. Nginx配置文件 nginx.conf 和default.conf 讲解

    nginx.conf /etc/nginx/nginx.conf ######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; ...

  2. nginx 分离配置文件 conf.d和default.conf

    1. 在 nginx.conf 文件中引用 conf.d 下的所有配置文件 #在http配置节的末尾添加配置引用 http { ... #gzip on; include /etc/nginx/con ...

  3. Centos7安装nginx后提示“Welcome to nginx on Fedora!”,conf.d目录下无default.conf文件

    问题描述 在腾讯云centos7上安装nginx sudo yum install nginx 打开默认网页显示 Welcome to nginx on Fedora! 且 /etc/nginx/co ...

  4. Spark Standalone spark-default.conf

    Example: spark.master spark://master:7077 spark.eventLog.enabled true spark.eventLog.dir hdfs://name ...

  5. nginx.conf几个示例

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

  6. 【转载】Docker 安装 Nginx 并个性化挂载配置文件 nginx.conf

    首先,系统(3.8以上内核的linux)中安装好 Docker 这个运用程序.由于网络原因,我们下载一个Docker官方的镜像需要很长的时间,甚至下载失败.为此,阿里云容器镜像服务提供了官方的镜像站点 ...

  7. Dockerfile + Nginx.conf文件记录(用于前端项目部署)

    Dockerfile + Nginx.conf文件记录(用于前端项目部署) 本教程依据个人理解并经过实际验证为正确,特此记录下来,权当笔记. 注:基于linux操作系统(敏感信息都进行了处理),默认服 ...

  8. 基础篇七:默认配置语法(/etc/nginx/nginx.conf)

    首选我们 vim nginx.conf 参照上图,我们看看nginx.conf 的个参数含义 我们再看看 /etc/nginx/conf.d/default.conf

  9. nginx.conf指令注释

    nginx.conf指令注释 ######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于C ...

随机推荐

  1. zabbix使用jmx监控tomcat

    zabbix监控Tomcat/JVM实例性能(115) – 运维生存时间http://www.ttlsa.com/zabbix/zabbix-use-jmx-monitor-tomcat/ zabbi ...

  2. Oracle 中sql文件的导入导出

    导出 一般导入的时候我用的是命令行 imp c##zs/@orcl fromuser=c##zs touser=c##zs file=D:\java\.dmp ignore=y c##zs 是创建的用 ...

  3. GitHub创建仓库,并与git本地仓库关联

    登录后头像右上角点击: 起名再create 后 会跳转到下面页面: 先在git上复制执行第一条指令,创建一个readme文档 然后再用第二条初始化仓库 第三步将readme文档添加至暂存区 然后提交一 ...

  4. 安装VC++2015运行库时出现0x80240037错误

    很多时候,当我们将开发好的软件部署到用户的机器上时总会出现各种意想不到的错误,最近在一台原版Windows7系统的电脑上安装VC++运行库的时候,莫名的出现安装失败,然后错误代码为:0x8024003 ...

  5. Antd & ice

    Antd & ice Angular https://github.com/NG-ZORRO/ng-zorro-antd https://ng.ant.design/docs/introduc ...

  6. postfix 邮箱设置及常见错误

    postfix 邮箱设置及常见错误 1.如果装了sendmail的话,先卸载了. yum remove sendmail 2.安装 Postfix yum install postfix 3.更改默认 ...

  7. 在delphi中生成GUID

    什么是 GUID ? 全球唯一标识符 (GUID) 是一个字母数字标识符,用于指示产品的唯一性安装.在许多流行软件应用程序(例如 Web 浏览器和媒体播放器)中,都使用 GUID. GUID 的格式为 ...

  8. Python——glob模块

    一.作用: 找到匹配上特定格式的所有文件和文件夹,跟windows的文件搜索功能差不多 二.三种匹配符 *代表0个或多个字符 ?代表一个字符 []匹配指定范围内的字符,如[0-9]匹配数 三.应用方法 ...

  9. 提示“Web打印服务CLodop未安装启动”的各种原因和解决方法

    旧版提示:"CLodop云打印服务(localhost本地)未安装启动!"新版提示:"Web打印服务CLodop未安装启动,点击这里下载执行安装(若此前已安装过,可点这里 ...

  10. 在Linq to sql 和 Entity framework 中使用lambda表达式实现left join

    在Linq to sql 和 Entity framework 中使用lambda表达式实现left join 我们知道lambda表达式在Linq to sql 和 Entity framework ...