linux下如何安装Nginx1.16.0
安装必要依赖插件yuminstall-ygccgcc-c++pcre\pcre-develzlibzlib-developensslopenssl-develwget创建文件夹并切换过去mkdir/customer&&cd/customer下载安装包(同样如果想安装其他的版本,可以去下面官网链接,选择其他版本的链接进行拷贝替换)wgethttps://nginx.org/download/nginx-1.16.0.tar.gz解压并安装tarzxvfnginx-1.16.0.tar.gzcdnginx-1
安装必要依赖插件
yum install -y gcc gcc-c++ pcre \ pcre-devel zlib zlib-devel openssl openssl-devel wget
创建文件夹并切换过去
mkdir /customer && cd /customer
下载安装包 (同样如果想安装其他的版本,可以去下面官网链接,选择其他版本的链接进行拷贝替换)
wget https://nginx.org/download/nginx-1.16.0.tar.gz
解压并安装
tar zxvf nginx-1.16.0.tar.gz cd nginx-1.16.0 ./configure --prefix=/usr/local/nginx make && make install
添加全局命令
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
测试安装
nginx -v
如下图,则安装成功:

验证服务是否启动成功
netstat -ntlp | grep nginx
如下:

添加nginx服务
vim /lib/systemd/system/nginx.service
将以下内容插入:
[unit] description=nginx after=network.target [service] type=forking execstart=/usr/local/nginx/sbin/nginx execreload=/usr/local/nginx/sbin/nginx -s reload execstop=/usr/local/nginx/sbin/nginx -s quit privatetmp=true [install] wantedby=multi-user.target
以服务的方式启动nginx
pkill nginx systemctl start nginx
查看服务是否启动
systemctl status nginx netstat -ntlp | grep nginx
配置nginx服务开机自动启动
systemctl enable nginx
这下子就安装完毕了 ,配置文件在:
vim /usr/local/nginx/conf/nginx.conf
可选:
nginx的版本号默认是打开的,可以在默认的错误页面和http响应头中查看到。
不同版本,特别是低版本的nginx可能存在漏洞,所以如果不希望被别人获取到版本号的话,可以选择进行版本号隐藏。
隐藏nginx版本号
cd /usr/local/nginx/conf vim nginx.conf
nginx.conf文件的“server_tokens”修改成”off“:
http {
...
server_tokens off;
...
}再修改fastcgi.conf
vim fastcgi.conf
修改如下行
fastcgi_param server_software nginx/$nginx_version; # 改为: fastcgi_param server_software nginx;
重启nginx
systemctl restart nginx
Windows 10 是一款微软推出的经典操作系统,拥有硬件兼容性与多任务处理能力。它更偏向把系统状态查看和常用调节动作放在一起,适合需要持续观察和微调设备状态的场景。
极度公式是一款跨平台专业LaTeX公式识别编辑软件,支持OCR公式识别和多平台编辑。和使用说明,避免使用,享受完整功能与稳定支持。做扫描整理、文字提取和表格转换时,它能把识别后的处理步骤接得更顺,资料录入这类场景会省下不少时间。
















