# 2、安装pcre wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz tar zxvf pcre-8.35.tar.gz mv pcre-8.35 /usr/local/ cd /usr/local/pcre-8.35 ./configure make && make install pcre-config --version
安装 nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# 1、安装之前,最好检查一下是否已经安装有nginx find -name nginx
# 2、如果系统已经安装了nginx,那么就先卸载 yum remove nginx
# 3、从官网下载最新版的nginx wget http://nginx.org/download/nginx-1.9.5.tar.gz tar -zxvf nginx-1.9.5.tar.gz mv nginx-1.9.5 /usr/local/ cd /usr/local/nginx-1.9.5
# 4、使用--prefix参数指定nginx安装的目录,make、make install安装 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35 make && make install
# 5、启动 cd /usr/local/nginx/sbin ./nginx // 启动
加入开机自启动
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
cd /lib/systemd/system/
vi nginx.service [Unit] Description=nginx service After=network.target
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x48d97cfd.
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
2、步骤二 列出当前分区使用情况 Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x48d97cfd
Device Boot Start End Blocks Id System
3、步骤三 添加磁盘分区 Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 // 起始扇区和Last扇区为区分磁盘分区大小的重要参数,如果需要将整个块作为一个分区使用默认值即可。如果需要精细化定制则计算分区大小。 First sector (2048-41943039, default 2048): Using default value 2048 // last扇区值可以使用:+扇区 的格式,例如:+2G 表示分配2G的分区 Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): Using default value 41943039 Partition 1 of type Linux and of size 20 GiB is set
4、步骤四 保存/退出分区 // 参数w为保持当前分区,q为取消退出分区 Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
upstream minio { server 192.168.2.231:9000; server 192.168.2.232:9000; server 192.168.2.233:9000; server 192.168.2.234:9000; } upstream console { ip_hash; server 192.168.2.231:9001; server 192.168.2.232:9001; server 192.168.2.233:9001; server 192.168.2.234:9001; }
server { listen 9000; listen [::]:9000; server_name localhost;
# To allow special characters in headers ignore_invalid_headers off; # Allow any size file to be uploaded. # Set to a value such as 1000m; to restrict file size to a specific value client_max_body_size 0; # To disable buffering proxy_buffering off; proxy_request_buffering off;
location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 300; # Default is HTTP/1, keepalive is only enabled in HTTP/1.1 proxy_http_version 1.1; proxy_set_header Connection ""; chunked_transfer_encoding off; proxy_pass http://minio; } }
server { listen 9001; listen [::]:9001; server_name localhost; # To allow special characters in headers ignore_invalid_headers off; # Allow any size file to be uploaded. # Set to a value such as 1000m; to restrict file size to a specific value client_max_body_size 0; # To disable buffering proxy_buffering off; proxy_request_buffering off; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; # This is necessary to pass the correct IP to be hashed real_ip_header X-Real-IP; proxy_connect_timeout 300; # To support websocket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; chunked_transfer_encoding off; proxy_pass http://console; } } }