Ubuntu nginx和安全狗的安裝與配置

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


分享到:


相關文章: