1. 下载最新版本的nginx包,我下载的是1.0.1版本。
http://www.nginx.org/en/download.html
2. 解压
tar zxvf nginx-1.0.1.tar.gz
3. 进入解压后的nginx目录中
# cd nginx-1.0.1 // 进入程序目录 # apt-get install build-essential // 安装编译环境 # apt-get install libpcre3-dev // 安装PCRE库 # apt-get install libssl-dev // 安装Openssl库
4. 准备工作完成以后,就可以开始安装了
a) 编译:
# ./configure --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_flv_module
如果编译最后出现类似下面的信息,表示编译已经成功:
Configuration summary + using system PCRE library + using system OpenSSL library + md5: using OpenSSL library + sha1 library is not used + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/etc/nginx" nginx configuration file: "/etc/nginx/nginx.conf" nginx pid file: "/var/run/nginx.pid" nginx error log file: "/var/log/nginx/error.log" nginx http access log file: "/var/log/nginx/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
b) 安装
# make # make install
5. 如果需要更新nginx版本,先按上述1~5的步骤安装好新的nginx,然后运行如下命令进行平滑升级
# kill -USR2 `/var/run/nginx.pid` # kill -QUIT `/var/run/nginx.pid.oldbin`
6. 安全起见,需要隐藏nginx的版本号,方法如下:
1)修改nginx.conf配置:
# vi /etc/nginx/nginx.conf
在http {—}里加上server_tokens off;
2)重新加载配置:
# service nginx reload
2021年9月06日 17:45
Needs to be reason, there isn't a doubt that this maid costume will be as popular while ever. Certainly much of the appeal on the costume emanates from the adult men who wish to see women wear it in lieu of from girls themselves needing to portray a new maid. It's been a serious fantasy involving men worldwide for decades.
2023年1月15日 13:30
"Debian is a popular Linux distribution that is known for its stability and security. In addition to these two features, Debian also has a large software repository that includes cbd for pets many popular applications. One of these applications is nginx, a high performance web server. Installing nginx on Debian is a simple process that can be completed in a few minutes. The first step is to update the package repository indexes. This can be done by running the following command: `sudo apt-get update` Next, install nginx using the following command: `sudo apt-get install nginx` Once the installation is complete, nginx will start automatically. "