$ apt-get update
$ apt-get install build-essential libtool libpcre3 libpcre3-dev zlib1g-dev
$ apt-get install openssl
$ apt-get install libssl-dev
複製代碼
$ cd /opt/
$ wget http://nginx.org/download/nginx-1.9.9.tar.gz
$ tar zxvf nginx-1.9.9.tar.gz
複製代碼
$ cd nginx-1.9.9
$ ./configure --prefix=/usr/local/nginx \--with-http_ssl_module
複製代碼
$ make
$ make && make install
複製代碼
默認安裝在/usr/local/nginx
html
裏面有四個目錄:nginx
每次修改nginx配置文件後都要進行檢查web
$ /usr/local/nginx/sbin/nginx -t
複製代碼
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
複製代碼
$ /usr/local/nginx/sbin/nginx
複製代碼
瀏覽器輸入本機IP ,看到以下內容證實安裝成功docker
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
複製代碼
$ /usr/local/nginx/sbin/nginx -s stop
複製代碼
$ /usr/local/nginx/sbin/nginx -s reload
複製代碼
安裝很簡單, 一個命令:vim
curl https://get.acme.sh | sh
複製代碼
cd ~/.acme.sh/
apt install socat
sh acme.sh --issue -d docker.souyunku.com --standalone
複製代碼
mkdir -p /certs
cd /root/.acme.sh/docker.souyunku.com
cp docker.souyunku.com.cer /certs
cp docker.souyunku.com.key /certs
複製代碼
vim /usr/local/nginx/conf/nginx.conf
複製代碼
server {
listen 443;
ssl on;
ssl_certificate /certs/docker.souyunku.com.cer;
ssl_certificate_key /certs/docker.souyunku.com.key;
}
複製代碼
每次修改nginx配置文件後都要進行檢查瀏覽器
$ /usr/local/nginx/sbin/nginx -t
複製代碼
$ /usr/local/nginx/sbin/nginx
複製代碼
瀏覽器訪問:docker.souyunku.com/curl