业务账号安装nginx

需要的tar包:

nginx-1.10.2.tar.gz,openssl-fips-2.0.10.tar.gz,pcre-8.40.tar.gz,zlib-1.2.11.tar.gz

解压openssl-fips-2.0.10.tar.gz,安装openssl-fips

lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ tar zxvf openssl-fips-2.0.10.tar.gz 

新建安装目标文件夹

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ mkdir openssl-fips

安装openssl-fips

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ cd openssl-fips-2.0.10

设置安装位置

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/openssl-fips-2.0.10]$ ./config --prefix=/home/lxgoread/openssl-fips

编译

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/openssl-fips-2.0.10]$ make

安装

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/openssl-fips-2.0.10]$ make install

 

然后相同步骤安装pcre-8.40,zlib-1.2.11

lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ tar zxvf pcre-8.40.tar.gz

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ mkdir pcre

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ cd pcre-8.40

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/pcre-8.40]$ ./configure --prefix=/home/lxgoread/pcre

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/pcre-8.40]$ make

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/pcre-8.40]$ make install

 

lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ tar zxvf zlib-1.2.11.tar.gz

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ mkdir zlib

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ cd zlib-1.2.11

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/zlib-1.2.11]$ ./configure --prefix=/home/lxgoread/zlib

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/zlib-1.2.11]$ make

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/zlib-1.2.11]$ make install

 

安装nginx

lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ tar zxvf nginx-1.10.2.tar.gz

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ mkdir nginx

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ cd nginx-1.10.2

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/nginx-1.10.2]$ ./configure --with-http_stub_status_module --prefix=/home/lxgoread/nginx --with-pcre=/home/lxgoread/pcre-8.40 --with-zlib=/home/lxgoread/zlib-1.2.11  --with-openssl=/home/lxgoread/openssl-fips-2.0.10

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/nginx-1.10.2]$ make

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~/nginx-1.10.2]$ make install

安装完成,接下来进行nginx配置

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ ~]$ cd nginx/conf/

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ conf]$ vi nginx.conf

user  root;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
underscores_in_headers on;
 include       mime.types;
 default_type  application/octet-stream;
 proxy_redirect          off;
 proxy_set_header        Host $host;
 proxy_set_header        X-Real-IP $remote_addr;
 proxy_set_header        X-Forwarded-For   $proxy_add_x_forwarded_for;
 client_max_body_size    10m;
 client_body_buffer_size 128k;
 proxy_connect_timeout   600;
 proxy_send_timeout      600;
 proxy_read_timeout      600;
 proxy_buffer_size       4k;
 proxy_buffers           4 32k;
 proxy_busy_buffers_size 64k;
 proxy_temp_file_write_size 64k;
 server_names_hash_bucket_size 128;
 client_header_buffer_size 4k;
 large_client_header_buffers 4 32k;
 open_file_cache max=65535 inactive=60s;
 open_file_cache_valid 80s;
 open_file_cache_min_uses 1;
 tcp_nopush     on;
 keepalive_timeout 60;
 tcp_nodelay on;

       #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
       #                  '$status $body_bytes_sent "$http_referer" '
       #                  '"$http_user_agent" "$http_x_forwarded_for"';
       
       #access_log  logs/access.log  main;
       sendfile        on;
       #tcp_nopush     on;
       
       #keepalive_timeout  0;
       
       #gzip  on;

    server {
        listen       8xx3;
        server_name  10.xxx.xx.101;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location ~ .(gif|jpg|jpeg|png|bmp|swf|css|js)$ {
            root   /home/lxgoread/tomcat-grpage/webapps/gr;
            index  index.html index.htm;
           #proxy_pass http://localhost:8080;
        }

        location ~ .html$ {
            root /home/lxgoread/tomcat-grpage/webapps/gr;
            index index.html index.htm;
        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
 

写好配置esc

:wq

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ conf]$ cd ../sbin/

检查配置

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ sbin]$ ./nginx -t

启动nginx

[lxgoread@ZJHZ-CMREAD-QLDSQ02-VBUS-SQ sbin]$ ./nginx

然后在/home/lxgoread/tomcat-grpage/webapps/gr目录下放张图片或者静态网页

浏览器访问http://10.xxx.xx.101:8xx3/index.html

至此,搞定nginx安装;

 

https协议支持

./configure --prefix=/home/lxgoread/nginx --with-http_ssl_module

如果报错

./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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值