cenos yum 安装nginx
来源:互联网 发布:ar涂色 源码 编辑:程序博客网 时间:2024/05/22 06:46
第一步,在/etc/yum.repos.d/
目录下创建一个源配置文件nginx.repo
:
1
2
3
cd
/etc/yum
.repos.d/
vim nginx.repo
填写如下内容:
1
2
3
4
5
[nginx]
name=nginx repo
baseurl=http:
//nginx
.org
/packages/centos/
$releasever/$basearch/
gpgcheck=0
enabled=1
保存,则会产生一个/etc/yum.repos.d/nginx.repo
文件。
下面直接执行如下指令即可自动安装好Nginx:
1
yum
install
nginx -y
安装完成,下面直接就可以启动Nginx了:
1
/etc/init
.d
/nginx
start
现在Nginx已经启动了,直接访问服务器就能看到Nginx欢迎页面了的。
如果还无法访问,则需配置一下Linux防火墙。
1
2
3
4
5
iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
service iptables save
service iptables restart
Nginx的命令以及配置文件位置:
1
2
3
4
5
/etc/init
.d
/nginx
start
# 启动Nginx服务
/etc/init
.d
/nginx
stop
# 停止Nginx服务
/etc/nginx/nginx
.conf
# Nginx配置文件位置
至此,Nginx已经全部配置安装完成。
domain.conf
server {
listen 80; ## listen for ipv4; this line is default and implied
index index.php index.html index.htm index.jsp;
server_name *.domain.com;
location ~ .*.*$ {
proxy_set_header Host $host;
proxy_pass_header User-Agent;
index index.jsp;
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 120;
client_max_body_size 100m;
}
}
listen 80; ## listen for ipv4; this line is default and implied
index index.php index.html index.htm index.jsp;
server_name *.domain.com;
location ~ .*.*$ {
proxy_set_header Host $host;
proxy_pass_header User-Agent;
index index.jsp;
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 120;
client_max_body_size 100m;
}
}
0 0
- cenos yum 安装nginx
- cenos => yum安装
- CenOS Linux安装nginx
- CenOS Linux安装nginx
- CenOS Linux安装nginx
- CenOS Linux安装nginx
- CenOS Linux安装nginx
- CenOS Linux安装nginx
- CenOS 7安装Nginx
- CenOS Linux安装nginx
- CenOs 安装 Nginx + Tcp 教程
- cenos 6.9 yum 安装myql-server 修改数据库路径
- cenos yum epel 源
- CenOS Linux下nginx的安装和配置
- rhel5 yum安装nginx
- centos yum安装nginx
- CentOS yum 安装 nginx
- yum安装nginx详解
- mq的链接 消息读取与存放
- java获取文件名, 提取字符串中局部字符串。拆分文件名及后缀
- 快学Scala读书笔记之Chapter 14(模式匹配和样例类)
- JM代码分析(三)
- CSDN博客积分规则和获取积分方法
- cenos yum 安装nginx
- ios框架介绍--C字头
- android RecyclerView 使用完全解析 替代ListView(一)
- css3网站
- VS2015 build kmdf for Window 8.1
- OpenCV 的内存泄露问题(静态内存泄露)
- jquery 弹出框
- java 中简单读取Properties配置文件
- 跨站脚本攻击实现原理