RedHat和CentOS下Nginx安装

2022-07-03 10:45:06 浏览数 (1)

官网当前最稳定的的版本是1.6.1,本教程以1.6.1为例:

1,RedHat和CentOS可以设置rpm源,

  • RHEL 5
  • RHEL 6
  • RHEL 7
  • CentOS 5
  • CentOS 6
  • CentOS 7

下载然后安装上面的文件

运行命令 yum install nginx

debian和Ubuntu可以配置如下源

deb http://nginx.org/packages/debian/ codename nginx

deb-src http://nginx.org/packages/debian/ codename nginx

deb http://nginx.org/packages/ubuntu/ codename nginx

deb-src http://nginx.org/packages/ubuntu/ codename nginx

运行

apt-get update

apt-get install nginx

2,源码编译

http://nginx.org/en/download.html 下载nginx1.6.1

代码语言:javascript复制
./configure
    --sbin-path=/usr/local/nginx/nginx
    --conf-path=/usr/local/nginx/nginx.conf
    --pid-path=/usr/local/nginx/nginx.pid
    --with-http_ssl_module
make
make install

中途可能有依赖关系,可以根据提示安装相关依赖

更多安装信息参考 http://nginx.org/en/docs/configure.html

0 人点赞