银河麒麟v10系统部署nginx(2)
<div class="cnblogs_code"><pre>wget https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz </span>
wget http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">zlib.net/zlib-1.2.11.tar.gz</span>
wget https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">www.openssl.org/source/openssl-1.1.1g.tar.gz</span>
wget http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">nginx.org/download/nginx-1.18.0.tar.gz</span>
<span style="color: rgba(0, 0, 0, 1)">################################################################################################
$ yum install gcc</span>-c++ gd gd-devel -<span style="color: rgba(0, 0, 0, 1)">y #安装c编译器,gd依赖
$ useradd </span>-M -s /sbin/<span style="color: rgba(0, 0, 0, 1)">nologin nginx #创建nginx用户用于管理后期nginx服务
$ tar xf nginx</span>-kylin_1.<span style="color: rgba(128, 0, 128, 1)">18.0</span>.tar.gz -C /data/<span style="color: rgba(0, 0, 0, 1)">#该包为nginx通用包,包括centos,麒麟x86,麒麟arm架构
$ cd </span>/data/nginx/nginx-<span style="color: rgba(128, 0, 128, 1)">1.18</span>.<span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)"> #进入nginx编译目录,准备一下编译
$.</span>/configure --user=nginx --group=nginx --sbin-path=/usr/sbin/ --prefix=/usr/local/nginx/ --with-pcre=/data/nginx/pcre-<span style="color: rgba(128, 0, 128, 1)">8.44</span>/ --with-zlib=/data/nginx/zlib-<span style="color: rgba(128, 0, 128, 1)">1.2</span>.<span style="color: rgba(128, 0, 128, 1)">11</span>/ --with-openssl=/data/nginx/openssl-<span style="color: rgba(128, 0, 128, 1)">1.1</span>.1g/ --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_degradation_module --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module--with-http_flv_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_image_filter_module --with-http_mp4_module --with-http_realip_module --with-http_random_index_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-debug--with-pcre-jit --add-module=/data/nginx/headers-more-nginx-module-master --add-module=/data/nginx/nginx-plugin-<span style="color: rgba(0, 0, 0, 1)">master
$ make </span>-j2 &&<span style="color: rgba(0, 0, 0, 1)"> make install #以前预编译完成,开始编译及安装</span><span style="color: rgba(0, 128, 0, 1)"><br></span></pre>
</div>
<div class="cnblogs_code">
<pre></pre>
<pre><span>##########vim /usr/local/nginx/conf/<span>nginx.conf #修改nginx主配置文件一下内容</span></span></pre>
<pre><span style="color: rgba(0, 0, 0, 1)">usernginx;
worker_processesauto;
#pid logs</span>/<span style="color: rgba(0, 0, 0, 1)">nginx.pid;
events {
worker_connections</span><span style="color: rgba(128, 0, 128, 1)">102400</span><span style="color: rgba(0, 0, 0, 1)">;
}
http {
include </span>/etc/nginx/conf.d<span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">.conf;
include mime.types;
default_typeapplication/octet-stream;
log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format logstash_json '{"@timestamp": "$time_iso8601", '
'"time_local": "$time_local", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"request": "$request", '
'"referer": "$http_referer", '
'"request_time": "$request_time", '
'"request_body": "$request_body", '
'"uri": $uri, '
'"status": $status, '
'"logger": "nginx", '
'"agent": "$http_user_agent", '
'"scheme": "scheme", '
'"server_name": $server_name, '
'"bytes":$body_bytes_sent, '
'"bytes_sent":$bytes_sent, '
'"http_cookie": $http_cookie, '
'"http_host": $http_host, '
'"http_x_api_method": $http_x_api_method, '
'"http_x_api_sign": "$http_x_api_sign", '
'"http_x_api_userid":$http_x_api_userid, '
'"http_x_forwarded": "$http_x_forwarded_for", '
'"upstr_addr": "$upstream_addr",'
'"upstr_host": "$upstream_http_host",'
'"upstream_status": "$upstream_status",'
'"ups_resp_time": "$upstream_response_time"}';
access_loglogs/access.loglogstash_json;
error_loglogs/error.log;
#sendfile on;
#tcp_nopush on;
#keepalive_timeout0;
keepalive_timeout360s;
gzip on;
gzip_disable "MSIE \.(?!.*SV1)";
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 6;
gzip_proxied any;
gzip_vary on;
gzip_types *;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_max_body_size 10240m;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
client_header_timeout 15s;
client_body_timeout 15s;
send_timeout 360s;
gzip_types text/css text/xml text/plain text/mathml text/vnd.sun.j2me.app-descriptor text/vnd.wap.wml text/x-component image/gif image/jpeg image/png image/tiff image/vnd.wap.wbmp image/x-icon image/x-jng image/x-ms-bmp image/svg+xml image/webp application/javascript application/atom+xml application/rss+xml application/font-woff application/java-archive application/json application/mac-binhex40 application/msword application/vnd.ms-powerpoint application/vnd.ms-excel application/pdf;
server {
listen 80;
server_namelocalhost;
location / {
root html;
indexindex.html index.htm;
}
error_page 500 502 503 504/50x.html;
location = /50x.html {
root html;
}
}
}</span></pre>
</div>
<div class="cnblogs_code">
<pre>$mkdir -p /etc/nginx/<span style="color: rgba(0, 0, 0, 1)">conf.d #创建域名存放路径
$ </span>/usr/local/nginx/sbin/nginx -<span style="color: rgba(0, 0, 0, 1)">t #测试nginx应用服务配置是否报错
$ </span>/usr/local/nginx/sbin/<span style="color: rgba(0, 0, 0, 1)">nginx #启动nginx服务
$ netstat </span>-tlnp |grep <span style="color: rgba(128, 0, 128, 1)">80</span> #查询nginx监听端口</pre>
</div>
<p> </p><br><br>
来源:https://www.cnblogs.com/ybinshi/p/15512078.html
頁:
[1]