CentOS6.8安装Nginx

一、安装编译工具及库文件

[[email protected] ~]# yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

二、首先要安装PCRE

PCRE 作用是让 Nginx 支持 Rewrite 功能。

下载、解压、编译安装、查看版本

 [[email protected] ~]# cd /usr/local/src/
 [[email protected] src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
 [[email protected] src]# tar -zxvf pcre-8.44.tar.gz
 [[email protected] src]# cd pcre-8.44
 [[email protected] pcre-8.44]# ./configure
 [[email protected] pcre-8.44]# make && make install
 [[email protected] pcre-8.44]# pcre-config --version
 8.44

三、安装Nginx

下载、解压、编译安装、查看版本、启动、访问

 [[email protected] src]# cd /usr/local/src/
 [[email protected] src]# wget http://nginx.org/download/nginx-1.14.2.tar.gz
 [[email protected] src]# tar -zxvf nginx-1.14.2.tar.gz
 [[email protected] src]# cd nginx-1.14.2
 [[email protected] nginx-1.14.2]# ./configure --with-pcre=/usr/local/src/pcre-8.44
 [[email protected] nginx-1.14.2]# make && make install
 [[email protected] nginx-1.14.2]# cd /usr/local/nginx
 [[email protected] nginx]# ./sbin/nginx -v
 nginx version: nginx/1.14.2
 [root@centos nginx]# ./sbin/nginx
 [[email protected] nginx]# ps -ef|grep nginx
 root       2291      1  0 17:04 ?        00:00:00 nginx: master process ./sbin/nginx
 nobody     2292   2291  0 17:04 ?        00:00:00 nginx: worker process
 root       2294   2266  0 17:04 pts/0    00:00:00 grep nginx

此时,输入ip:端口可以访问,访问之前要配置防火墙,开发80端口

 [[email protected] nginx]# vim /etc/sysconfig/iptables
 # Firewall configuration written by system-config-firewall
 # Manual customization of this file is not recommended.
 *filter
 :INPUT ACCEPT [0:0]
 :FORWARD ACCEPT [0:0]
 :OUTPUT ACCEPT [0:0]
 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 -A INPUT -p icmp -j ACCEPT
 -A INPUT -i lo -j ACCEPT
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
 -A INPUT -j REJECT --reject-with icmp-host-prohibited
 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
 COMMIT
 [root@centos sbin]# service iptables restart

参考文档:https://www.runoob.com/linux/nginx-install-setup.html

原文地址:https://www.cnblogs.com/ddstudy/p/12547056.html

时间: 2024-11-09 00:11:22

CentOS6.8安装Nginx的相关文章

centos6.3安装nginx

一般使用linux系统的不少网友可能都是直接使用一键安装包进行安装的,以前作者也这样,但是很多时候这些一键安装方便是方便但是可能在升级及其他很多地方不是很好,本文就说下在centos6.3安装nginx1.2的步骤. 安装说明 操作系统:centos6.3 软件:nginx-1.2.6.tar.gz 安装方式:源码编码安装 安装位置:/usr/local/nginx nginx下载地址:http://nginx.org/en/download.html 准备工具 在安装nginx衫,需要确保系统

CentOS6.5安装nginx及负载均衡配置

所有的安装包可以去以下地址下载,或者自行去官网下载,下面都有介绍. 所有安装包地址:http://download.csdn.net/detail/carboncomputer/9238037 原文地址:http://www.cnblogs.com/zhongshengzhen/p/nginx.html 1.下载PCRE, 是一个用C语言编写的正则表达式函数库 [[email protected] pcre-8.36]# cd /tmp/download/ [[email protected]

Centos6.6安装Nginx

1.在安装nginx之前,需要先安装该模块需要依赖包 yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel 2.安装完成后,下载wsgi pip install wsgi 3.安装nginx wget http://nginx.org/download/nginx-1.9.2.tar.gz tar -zxvf nginx-1.9.2.tar.gz ./configure --prefix=/usr/local/

centos6.5安装Nginx

设置源 创建文件 /etc/yum.repos.d/nginx.repo ,内容为: [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1 安装 yum install nginx 查看Nginx,启动Nginx service nginx status nginx 或 service nginx start 重启Nginx nginx -s reloa

centos6.8 安装nginx

准备条件 yum install -y gcc-c++yum install -y pcre pcre-develyum install -y zlib zlib-develyum install -y openssl openssl-devel 安装 wget  https://nginx.org/download/nginx-1.8.0.tar.gz tar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 ./configure --prefix=/usr/lo

centos6 编译安装nginx

yum install pcre pcre-devel openssl openssl-devel -yuseradd -M -s /sbin/nologin wwwtar zxvf nginx-1.10.3.tar.gz cd nginx-1.10.3 ./configure \--user=www \--group=www \--prefix=/usr/local/nginx \--with-http_stub_status_module \--with-http_ssl_module \-

centos6 yum安装nginx

[[email protected] ~]#rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm [[email protected] ~]#yum info nginx [[email protected] ~]#yum install nginx [[email protected] ~]# service nginx start Starting

【CentOS6.5】安装nginx报错:No package nginx available. Error: Nothing to do

今天在给centos6.5安装nginx时候,提示报错No package nginx available. Error: Nothing to do, 后来百度一下,说缺少EPEL(epel是社区强烈打造的免费开源发行软件包版本库,系统包含大概有1万多个软件包) 版本寻找地址:http://fedoraproject.org/wiki/EPEL我需要的是centos6.5 64位(适用于6.x),我直接找到源后wget下载到当前目录: wget http://dl.fedoraproject.

Linux--centos6.5 安装nginx+tomcat 服务器整合

Linux*centos6.5 安装nginx+tomcat 服务器整合 前言:研究了2天也出现过很多错误,网上的资料很多但是都不是很全,我是拼凑出来在结合自己的理解配置出来的,怕以后忘了记载在这里,如有不对的地方还请包涵. 一.首先,你要安装jdk(我的版本问1.8)自己到官网下载(我是root的权限). 我的服务器环境为---centos 6.5 64 [[email protected] ROOT]# rpm -ivh jdk-8u60-linux-x64.rpm [[email prot