nginx默认配置和默认站点启动
1.nginx的配置文件nginx.conf
cd /etc/nginx/
vim nginx.conf
打开后的文件为:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;//所有nginx 的content-type的配置
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' //定义日志类型
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;//定义访问的日志
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;//客户端和服务端超时的时间
#gzip on;
include /etc/nginx/conf.d/*.conf;//子配置文件
}
2.nginx.conf的子配置文件(/etc/nginx/conf.d/*.conf)
cd /etc/nginx/conf.d/
ls
vim default.conf
打开的文件为
server {
listen 80;//server所监听的端口
server_name localhost;//server的服务名,服务用域名方式访问的域名的地址
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {//一个server可以有多个location,location /代表一个server当没有其他的路径的时候默认采用/,访问所有的首页路径或自路径都进入到这个location中进行访问
root /usr/share/nginx/html;//location里面所返回的页面的路径
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 404 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
"default.conf" 45L, 1096C
nginx默认配置和默认站点启动的更多相关文章
- 在Nginx上配置多个站点
有时候你想在一台服务器上为不同的域名运行不同的站点.比如www.siteA.com作为博客,www.siteB.com作为论坛.你可以把两个域名的IP都解析到你的服务器上,但是没法在Nginx的根目录 ...
- omcat配置多域名站点启动时项目重复加载多次
在tomcat中配置多个Host的时候, 出现项目重复启动多次的情况. 刚开始以为是spring boot发布项目的时候自带了一个tomcat引起的, 后来发现不是 参考了这两篇文章, 解决问题 ht ...
- 使用Typescript重构axios(十五)——默认配置
0. 系列文章 1.使用Typescript重构axios(一)--写在最前面 2.使用Typescript重构axios(二)--项目起手,跑通流程 3.使用Typescript重构axios(三) ...
- webpack 4:默认配置
webpack 4:默认配置 entry 默认: ./src/index.js(注意: 路径必须带上./): entry: './src/index.js', output 默认最后路径: ./dis ...
- (三)Spring Boot 官网文档学习之默认配置
文章目录 继承 `spring-boot-starter-parent` 覆盖默认配置 启动器 原文地址:https://docs.spring.io/spring-boot/docs/2.1.3.R ...
- CentOS7安装Nginx及配置
Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttpd具有占有内存少,稳定性高等优势.**它最常的用途是提供反向代理服务.** 安装 在Centos下,yum源不 ...
- 【Nginx安装】CentOS7安装Nginx及配置
[Nginx安装]CentOS7安装Nginx及配置 2018年03月05日 11:07:21 阅读数:7073 Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttp ...
- nginx 默认配置语法和日志的format
nginx 默认配置 查看有nginx哪些默认配置文件,打开/etc/nginx/nginx.conf文件,查看尾行部分 会默认将/etc/nginx/conf.d/文件下其他以.conf结尾的配置文 ...
- Nginx.conf配置文件默认配置块略解
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #erro ...
随机推荐
- Hibernate学习笔记3.3(Hibernate组建映射2)
多对多 相当于一个老师可以教多个学生,一个学生也可以有多个老师 数据表中都是再设计一个表寸相关的id 1.多对多单向 1annotation Student.java package com.bjsx ...
- Generative Adversarial Networks,gan论文的畅想
前天看完Generative Adversarial Networks的论文,不知道有什么用处,总想着机器生成的数据会有机器的局限性,所以百度看了一些别人 的看法和观点,可能我是机器学习小白吧,看完之 ...
- com.android.dx.command.Main with arguments
Error:Execution failed for task ':jingyeyun:transformClassesWithDexForDebug'.> com.android.build. ...
- maven <scope>provided</scope>
今天开发web的时候,需要用到servlet-api,于是在pom.xml中添加依赖 <dependency> <groupId>javax.servlet</group ...
- Velocity Obstacle
[Velocity Obstacle] Two circular objects A,B, at time t(0), with velocity V(A),V(B). A represent the ...
- break
public class b { public static void main(String[] args) { int i=0; for(;i<=10;i++){ if (i&g ...
- shell 通过shift获得某位后的入参
有时shell的入参个数不定,想要获得第2位后的参数,作为新的入参调用其他脚本 通常这时候想到的方法是用遍历,例如下面的方法: for (( i=2;i<=$#;i++)) do ...
- jdk1.8的项目在jdk1.7的环境下运行
- 把图片上的文字转换成word文字?
转换后的文字不是很如意,但是免费方便. 1.打开Office办公软件自带的OneNote工具.随便新建一个笔记页面,以方便我们接下来的操作. 2.插入图片.在菜单栏里点击[插入],选择插入[图片],找 ...
- Cisco N3K VPC+HSRP+ospf 配置
VPC概念 VPC:vpc是指vpc对等体设备和下游设备之间的组合PortChannel. vpc对等交换:就是组成vpc功能的两个nexus系列交换机,一个设备为主,一个为备. vpc对等连接:用于 ...