nginx的安装
- 安装快速HTTP服务器“的Nginx”并配置HTTP服务器
# install from EPEL
[root@linuxprobe~]# yum --enablerepo=epel -y install nginx
# 基础设置
[root@linuxprobe~]# vi /etc/nginx/nginx.conf
# line 40: change hostname
server_name linuxprobe.org;
[root@linuxprobe ~]# systemctl start nginx
[root@linuxprobe ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@linuxprobe ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain linuxprobe.org
10.1.1.56 vdevops.com
# 开启防火墙
[root@linuxprobe ~]# firewall-cmd --add-service=http --permanent
提示FirewallD is not running
https://jingyan.baidu.com/article/5552ef47f509bd518ffbc933.html
success
[root@linuxprobe ~]# firewall-cmd --reload
success
- 客户端设置主机,从浏览器访问linuxprobe.org
虚拟主机设置
- 配置nginx的
[root@linuxprobe ~]# vi /etc/nginx/conf.d/linuxcool.com.conf
# create new
server {
listen 80;
server_name linuxcool.com;
location / {
root /usr/share/nginx/linuxcool;
index index.html index.htm;
}
}
[root@linuxprobe ~]# mkdir /usr/share/nginx/linuxcool
[root@linuxprobe w ~]# systemctl restart nginx
- 创建测试页面
[[email protected] ~]# vi /usr/share/nginx/virtual.host/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Nginx LinuxCool Test Page
</div>
</body>
</html>
配置nginx视频
http://v.youku.com/v_show/id_XMjgwOTU2MDM1Mg==.html