1. 首页
  2. 服务器
  3. 详情

ubuntu服务器安装nginx添加开机启动

changs  • 

1、安装依赖包

apt-get install libpcre3 libpcre3-dev zlib1g-dev libssl-dev build-essential


2、编译源码

--with-openssl指向的是源码目录

./configure --prefix=/usr/local/nginx --with-openssl=/softs/openssl-1.1.0c/ --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module

#--with-openssl=/softs/openssl-1.1.0c/指向的是openssl源码包,不是安装位置


3、安装

make

make install


4、将命令链到init.d

ln -s /usr/local/nginx/sbin/nginx /etc/init.d/


5、添加开机启动nginx

编辑/etc/rc.local中添加/etc/init.d/nginx。当然要添加到语句:exit 0 前面才行。

或者update-rc.d nginx defaults NN命令(NN为启动顺序)



声明:若要转载FengHuoX中的任何博客请注明转载地址