#检查gcc版本
gcc -v
#没有则安装
apt install gcc
#安装依赖
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g-dev
apt-get install openssl
sudo apt-get install openssl libssl-dev
#官网下载nginx
wget https://nginx.org/download/nginx-1.20.1.tar.gz
#切换到解压的nginx源码,编译安装
./configure 使用此方式编译不会生成ssl模块,后期配置nginx的ssl时出错
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && sudo make install
参考:
https://blog.csdn.net/qq_22808061/article/details/106127578?ops_request_misc=&request_id=&biz_id=102&utm_term=Ubuntu1804%E5%AE%89%E8%A3%85nginx&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-3-.pc_search_result_cache&spm=1018.2226.3001.4187