搜索

nginx怎么安装在linux中

发布网友 发布时间:2022-03-20 21:23

我来回答

3个回答

热心网友 时间:2022-03-20 22:52

一、下载→编译→安装→启动
1.下载nginx最新版
到官方网站上下载最新的tar.gz包
直接下载nginx的url为http://nginx.org/download/nginx-{version}.tar.gz,其中{version}为nginx的版本号
命令:[root@localhost ~]# wget http://nginx.org/download/nginx-1.9.14.tar.gz
2.解压文件
[root@localhost ~]# tar -zvxf nginx-1.9.14.tar.gz
3.进入nginx解压目录
[root@localhost ~]# cd nginx-1.9.14
4.使用参数进行编译,后面会给出编译参数的具体解释
[root@localhost nginx-1.9.14]# ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-http_ssl_mole –with-http_realip_mole –with-http_addition_mole –with-http_sub_mole –with-http_dav_mole –with-http_flv_mole –with-http_mp4_mole –with-http_gunzip_mole –with-http_gzip_static_mole –with-http_random_index_mole –with-http_secure_link_mole –with-http_stub_status_mole –with-http_auth_request_mole –with-mail –with-mail_ssl_mole –with-file-aio –with-ipv6 –with-http_v2_mole
5.执行编译过程
[root@localhost nginx-1.9.14]# make && make install
6.配置nginx.conf
7.启动nginx
[root@localhost nginx-1.9.14]# nginx
二、编译参数
–prefix=path
定义保存服务器文件的目录。这个目录同时将作用于nginx.conf配置文件中配置的相对路径(但不包括源码库的路径)。默认值为/usr/local/nginx。
–sbin-path=path
设置nginx可执行文件的名称,该名称只在安装期间使用。默认值是prefix/sbin/nginx
–conf-path=path
设置nginx.conf配置文件的名称。如果需要,nginx可以使用不同的配置文件启动,你可以通过命令行参数 -c file启动。默认文件名为prefix/conf/nginx.conf
–pid-path=path
设置nginx.pid文件的名称,nginx.pid用于存储主进程的进程ID。安装后,该文件名称可以在nginx.conf的pid指令中修改。默认为prefix/logs/nginx.pid
–error-log-path=path
设置重要的错误、警告以及诊断文件的名字。安装后,可以通过nginx.conf的error_log指令修改。默认为prefix/logs/error.log
–http-log-path=path
记录主要请求日志的名称,安装后通过access_log指令修改。默认为prefix/logs/access.log
–user=name
设置工作进程的用户名,安装后可以通过user指令修改。默认值为nobody
–group=name
设置工作进程的用户组,安皇后可以通过user指令修改,默认与user相同。
–with-xxx_mole
安装xxx模块,这些模块可以在nginx文档中找到。
–without-xxx_mole
不安装xxx模块(有些模块是默认安装的,如果不想安装,可以通过这个参数屏蔽),这些模块可以在nginx文档中找到。

热心网友 时间:2022-03-21 00:10

linux安装nginx 一般直接下载源码包 nginx-1.6.1.tar.gz tar xf *.tar.gz 解压 ./configure make make install 大概步骤就是这样 具体可以看看《linux就该这么学》这本书里面有截图

热心网友 时间:2022-03-21 01:45

第四步参数:‘–prefix=/etc/nginx’这个会报错。
声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-MAIL:11247931@qq.com
Top