请确保以具有
sudo
权限的用户身份登录,并且您没有在端口80
或443
上运行 Apache 或任何其他 Web 服务器。
[root@zwp-server:~] yum install -y gcc gcc-c++
注意:ubuntu编译安装软件报错configure: error: Invalid C++ compiler or C++ compiler flags
ubuntu不像centos一样是gcc-c++,ubuntu的是build-essential。
解决办法:
//sudo apt-get update --如果安装报错则需要更新apt-get
sudo apt-get install build-essential
# 1.下载
[root@zwp-server:local] wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz
# 2.解压
[root@zwp-server:local] tar -zxvf pcre-8.45.tar.gz
# 3.进⼊pcre⽬录
[root@zwp-server:local] cd pcre-8.45
# 4.配置
[root@zwp-server:pcre-8.45] ./configure
# 5.编译安装
[root@zwp-server:pcre-8.45] make && make install
[root@zwp-server:pcre-8.45] cd /usr/local
# 1.下载
[root@zwp-server:local] wget https://www.openssl.org/source/openssl-1.1.1t.tar.gz
# 2.解压
[root@zwp-server:local] tar -zxvf openssl-1.1.1t.tar.gz
# 3.进⼊⽬录
[root@zwp-server:local] cd openssl-1.1.1t/
# 4.配置
[root@zwp-server:openssl-1.1.1t] ./config
# 5.编译安装
[root@zwp-server:openssl-1.1.1t] make && make install
[root@zwp-server:openssl-1.1.1t] cd /usr/local
# 1.下载
[root@zwp-server:local] wget http://zlib.net/zlib-1.2.13.tar.gz
# 2.解压
[root@zwp-server:local] tar -zxvf zlib-1.2.13.tar.gz
# 3.进⼊⽬录
[root@zwp-server:local] cd zlib-1.2.13/
# 4.配置
[root@zwp-server:zlib-1.2.13] ./configure
# 5.编译安装
[root@zwp-server:zlib-1.2.13] make && make install
[root@zwp-server:zlib-1.2.13] cd /usr/local
# 1.下载
[root@zwp-server:local] wget http://nginx.org/download/nginx-1.24.0.tar.gz
# 2.解压
[root@zwp-server:local] tar -zxvf nginx-1.24.0.tar.gz
# 创建nginx服务目录
[root@zwp-server:local] mkdir -p server/nginx
# 3.进⼊⽬录
[root@zwp-server:local] cd nginx-1.24.0/
# 4.配置
[root@zwp-server:nginx-1.24.0] ./configure --prefix=/usr/local/server/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.45
# 5.编译安装
[root@zwp-server:nginx-1.24.0] make && make install
注意: 如果在配置过程中出现了以下错误:
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
# 执⾏:
yum -y install openssl openssl-devel
简介:Nginx
(engine x) 是一个免费的,开源的,高性能的 HTTP和反向代理 web服务器,同时也提供了IMAP/POP3/SMTP服务。
sudo apt update
# 下面二选一
sudo apt install nginx
sudo apt install -y nginx
# 查看nginx是否安装成功
nginx -v
# 查看nginx启动状态 --下面二选一
service nginx status
systemctl status nginx
# nginx文件安装完成之后的文件位置:
/usr/sbin/nginx:主程序
/etc/nginx:存放配置文件
/usr/share/nginx:存放静态文件
/var/log/nginx:存放日志
# 彻底卸载nginx
sudo apt --purge autoremove nginx
#查看nginx的版本号
nginx -v
# 要停止Nginx服务,请运行:
sudo systemctl stop nginx
# 要再次启动,请键入:
sudo systemctl start nginx
# 重新启动Nginx服务:
sudo systemctl restart nginx
# 在进行一些配置更改后重新加载Nginx服务:
sudo systemctl reload nginx
# 如果你想禁用Nginx服务在启动时启动:
sudo systemctl disable nginx
# 并重新启用它:
sudo systemctl enable nginx
https://blog.csdn.net/alfiy/article/details/123206823
https://www.cnblogs.com/fireblackman/p/15692833.html