有没哪位能帮忙看下?
-------------------------
Re:回 2楼(dongshan8) 的帖子
centos 7.2 64位系统。
一、准备工作
1.安装一些组件和库
yum -y install gcc wget automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel zlib
2.下载nginx
cd /root/lnamp
wget http://nginx.org/download/nginx-1.10.1.tar.gz
二、安装nginx
1.先创建用户和用户组
groupadd www
useradd -g www www -s /bin/false
2.创建一个nginx目录用来存放运行的临时文件夹
mkdir -p /var/cache/nginx
3.开始安装nginx
解压nginx
tar zxvf nginx-1.10.1.tar.gz
cd nginx-1.10.1
2.进行configure
./configure \
--prefix=/usr/local/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=nobody \
--group=nobody \
--with-pcre \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_v2_module \
--with-threads \
--with-stream \
--with-stream_ssl_module
3.make && make install
make && make install
4.启动nginx
/usr/sbin/nginx
5.用ps aux来查看nginx是否启动
ps aux|grep nginx
6.然后配置服务
vi /usr/lib/systemd/system/nginx.service
按"i"输入以下内容
[Unit]
Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPIDPrivateTmp=true
[Install]
WantedBy=multi-user.target
编辑好后保存
:wq!
(注)
[Unit]部分主要是对这个服务的说明,内容包括Description和After,Description用于描述服务,After用于描述服务类别
[Service]部分是服务的关键,是服务的一些具体运行参数的设置,这里Type=forking是后台运行的形式,PIDFile为存放PID的文件路径,ExecStart为服务的具体运行命令,ExecReload为重启命令,ExecStop为停止命令,PrivateTmp=True表示给服务分配独立的临时空间,注意:[Service]部分的启动、重启、停止命令全部要求使用绝对路径,使用相对路径则会报错!
[Install]部分是服务安装的相关设置,可设置为多用户的
7.开启开机启动
systemctl enable nginx.service
8.测试配置文件
用命令关掉nginx
pkill -9 nginx
后面可以用systemctl来操作nginx.service
systemctl start nginx.service
可以看到已启动成功
访问ip会看到nginx的启动画面
-------------------------
以上是安装过程,有错误吗?
-------------------------
回 5楼(龙吟风) 的帖子
.进行configure 通过,只是make出错