luosongchao

参考资料:http://nginx.org/en/linux_packages.html#stable

 

1、添加nginx.repo

2、配置nginx

3、启动nginx

 

1、添加nginx.repo

nginxpath

注:

      nginx.repo 路径为 /etc/yum.repos.d/nginx.repo

 

nginxconfig

注:

      nginx.repo 内容如上所示,因为是centos 6.4 所以,这里使用的是centos/6/$basearch/

      gpgcheck=0 

      baseurl是你的YUM源地址enabled=0是否启用这个仓库,1为起用,0为禁用gpgcheck=1 设置gpgcheck=1会让yum检查每个下载的RPM的GnuPG签名。这么做是因为你需要适当的GnuPG key注册到您的RPM数据库。可以防止被欺骗

然后使用  yum install nginx 即可

 

2、配置nginx

防火墙管理:iptables,参考本博客另外文章

 

3、启动与关闭

     命令:

           service nginx  restart

           service nginx  start

           service nginx stop

4、效果预览:输入http://serverIP/  【 例如 http://localhost 】

5、修改nginx端口号

     由于安装apache默认端口号为80,因此这里将nginx端口号设置为81

     

     nginx配置文件位置如上图:/etc/nginx/conf.d/default.conf

     

     修改端口号为81

 

     修改iptables,开放81端口:

      

     修改iptables位置为:/etc/sysconfig/iptables

     

   添加如上信息之后,重启iptables和nginx

   #service iptables restart 

   #service nginx restart 

 

分类:

技术点:

相关文章:

  • 2021-08-09
  • 2021-11-08
  • 2021-09-28
  • 2021-09-17
  • 2020-05-30
  • 2021-09-28
  • 2021-08-21
  • 2017-12-08
猜你喜欢
  • 2019-05-22
  • 2020-03-22
  • 2021-01-01
  • 2021-08-07
  • 2021-12-07
  • 2021-08-16
  • 2018-04-12
  • 2018-06-22
相关资源
相似解决方案