首页 > 其他 > 详细

centos7.2 安装nginx

时间:2018-01-26 23:51:12      阅读:306      评论:0      收藏:0      [点我收藏+]

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
  • 创建测试页面
 [root@linuxprobe ~]# 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

centos7.2 安装nginx

原文:https://www.cnblogs.com/nyfz/p/8361921.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!