centos安装Nginx

    8  yum install net-tools

    9  yum install wget

   10  yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

   12  mkdir src

   14  cd src/

   15  wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

   17  tar zxvf pcre-8.35.tar.gz 

   18  cd pcre-8.35

   19  ./configure

   20  make && make install

   21  pcre-config --version

   42  wget http://nginx.org/download/nginx-1.15.0.tar.gz

   44  mv nginx-1.15.0.tar.gz ../

   48  cd src/

   50  tar zxvf nginx-1.15.0.tar.gz 

   51  cd nginx-1.15.0

   61  ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/root/src/pcre-8.35

   64  /usr/local/webserver/nginx/sbin/nginx -v

   65  /usr/sbin/groupadd www

   66  /usr/sbin/useradd -g www www

   68  vim /usr/local/webserver/nginx/conf/nginx.conf

   69  yum install vim

   70  vim /usr/local/webserver/nginx/conf/nginx.conf

   71  /usr/local/webserver/nginx/sbin/nginx -t

   72  netstat -nlp | grep 80

   73  /usr/local/webserver/nginx/sbin/nginx 

   74  netstat -nlp | grep 80

   75  /usr/local/webserver/nginx/sbin/nginx -s reload

   76  ip addr

  121  curl -i 10.211.55.11:80

  122  curl -i localhost


虚拟机修改 /etc/hosts /etc/sysconfig/network,添加
10.0.XX.XX domain.com
客户机的/etc/hosts也添加上即可通过域名访问


关闭防火墙,其他机器才能访问
  124  systemctl status firewalld.service

  125  systemctl stop firewalld.service

  126  systemctl status firewalld.service

  127  systemctl status firewalld.service

  128  systemctl disable firewalld.service

  129  systemctl status firewalld.service

如果想在系统启动时启用Nginx。请输入以下命令:
sudo systemctl enable nginx 

扩展知识:
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
查看已启动的服务列表:systemctl list-unit-files|grep enabled
文章来源: centos安装Nginx

人吐槽 人点赞

猜你喜欢

发表评论

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:centos安装Nginx