linux - 编译并安装 openresty. (加强版的nginx)

访问量: 152

参考:  https://openresty.org/cn/download.html

1. 下载源代码   wget https://openresty.org/download/openresty-1.17.8.2.tar.gz

2. 解压缩   tar xvf openresty-1.17.8.2.tar.gz

3. 安装第三方依赖包

apt-get install libpcre3-dev libssl-dev perl make build-essential curl

4. cd openresty...

5. ./configure -j2

nginx path prefix: "/usr/local/openresty/nginx"
nginx binary file: "/usr/local/openresty/nginx/sbin/nginx"
nginx modules path: "/usr/local/openresty/nginx/modules"

6. make -j2

7. make install 

就可以把编译后的二进制文件,copy到对应的文件夹中。

8. (可选), 修改登录后的该用户的配置文件

附:nginx配置文件:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;
}

http {

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	gzip on;
	gzip_disable "msie6";

	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}


订阅/RSS Feed

Subscribe

分类/category