$ 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
里面有四个目录:
每次修改nginx配置文件后都要进行检查
$ /usr/local/nginx/sbin/nginx -t
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
$ /usr/local/nginx/sbin/nginx
浏览器输入本机IP ,看到如下内容证明安装成功
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
安装很简单, 一个命令:
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
浏览器访问:https://docker.souyunku.com/
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句