Ubuntu16.04 apt-get 安装的nginx 版本1.10.0
由于sbin和conf文件不在同一目录,所以安装过程会报错,安装失败。
详细安装过程
root@server:~# apt-get install nginx //安装nginx root@server:~# nginx -v //查看nginx版本 nginx version: nginx/1.10.0 (Ubuntu) root@server:~# wget http://down.safedog.cn/safedog_linux64.tar.gz //下载安全狗安装包 root@server:~# ls //列目录 safedog_linux64.tar.gz 公共的 模板 视频 图片 文档 下载 音乐 桌面 root@server:~# tar xzvf safedog_linux64.tar.gz //解安全狗压缩包 root@server:~# ls //列出当前目录文件 safedog_an_linux64_2.8.16709 公共的 视频 文档 音乐 safedog_linux64.tar.gz 模板 图片 下载 桌面 root@server:~# cd safedog_an_linux64_2.8.16709 //进入解压好的安全狗目录 root@server:~/safedog_an_linux64_2.8.16709# ls //列出当前目录文件 install_files install.py uninstall.py root@server:~/safedog_an_linux64_2.8.16709# ./install.py //运行安装脚本 1. Select Install Apache. 2. Nginx defense module(enter Ctrl-C to exit). input 1 or 2: 2 //apache选择1,nginx选择2 step 1/3, start install common lib [ok] step 2/3, start Install Server Defense Module step 2.1, checking os release version... [ok] step 2.2, check app needed... [ok] step 2.3, installing file... [ok] step 2.4, start service... [ok] step 2.5, save safedog install info... Tips: (1)safedog install directory: /etc/safedog (2)install safedog version: 2.8.16709 install safedog completely step 3/3, start install Nginx Defense Module.. step 3.1, input Nginx install path: [enter "CTRL+c" to exit] For example:/usr/local/nginx Please input the absolute path:/usr/local/nginx //输入nginx的安装目录 Warn: the path you inputted is not exist! Please input the absolute path:/usr/sbin/ //输入nginx的安装目录,第一次安装配置不正确,所以会在这里报错 Error: cann't not find sbin or conf directory! Install Completely!
在step 3.1 处,由于sbin和conf文件不在同一目录,所以不管你怎么输入,都会报错,所以在此之前,需要把sbin和conf文件放在一起
root@server:~/safedog_an_linux64_2.8.16709# whereis nginx //搜索nginx的相关目录 nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx root@server:~/safedog_an_linux64_2.8.16709# mkdir /usr/local/nginx/ //在/usr/local/下创建nginx目录,ubuntu16.04没有这个目录 root@server:~/safedog_an_linux64_2.8.16709# cd /usr/local/nginx/ //打开/usr/local/nginx/目录 root@server:/usr/local/nginx# ln -s /usr/sbin/ ./sbin //创建/usr/sbin/的软连接到当前目录,并命名为sbin root@server:/usr/local/nginx# ln -s /etc/nginx ./conf //创建/etc/nginx的软连接到当前目录,并命名为conf root@server:/usr/local/nginx# ls //列出当前目录的文件 conf sbin root@server:/usr/local/nginx# cd ~/safedog_an_linux64_2.8.16709 //打开safedog_an_linux64_2.8.16709目录 root@server:~/safedog_an_linux64_2.8.16709# ./install.py //重新安装安全狗程序 stop safedog server .... 1. Select Install Apache. 2. Nginx defense module(enter Ctrl-C to exit). input 1 or 2: 2 step 1/3, start install common lib [ok] step 2/3, start Install Server Defense Module step 2.1, checking os release version... [ok] step 2.2, check app needed... [ok] step 2.3, installing file... [ok] step 2.4, start service... [ok] step 2.5, save safedog install info... Tips: (1)safedog install directory: /etc/safedog (2)install safedog version: 2.8.16709 install safedog completely step 3/3, start install Nginx Defense Module.. step 3.1, input Nginx install path: [enter "CTRL+c" to exit] For example:/usr/local/nginx Please input the absolute path:/usr/local/nginx //输入刚才配置好的目录 step 3.2, copy libraries [ok] step 3.3, copy bin and set boot [ok] step 3.4, download nginx.. [ok] step 3.5, start the nginx server.. [ok] Tips: (1)If you want to change the configuration of nginx defense module, please modify the files in /etc/safedog/nginx/conf; (2)If you want to check nginx defense module log, please use command: sdalog -n; (3)If nginx defense module is failed to use, you can try to restart Nginx. send command to server ok. Install Completely!
到此,安装完成!命令部分已经加粗显示,懒人请看下面,仅需四步即可解决环境问题
mkdir /usr/local/nginx/ cd /usr/local/nginx/ ln -s /usr/sbin/ ./sbin ln -s /etc/nginx ./conf
安全狗官网http://www.safedog.cn
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/117983.html