国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Nginx > 正文

Linux環(huán)境下安裝Nginx及其使用

2024-08-30 12:21:58
字體:
供稿:網(wǎng)友
這篇文章主要介紹了Linux環(huán)境下安裝Nginx及其使用,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

一、查看CentOS的版本

cat /etc/redhat-release

二、添加資源庫

在 CentOS 系統(tǒng)上安裝 Nginx ,得先去添加一個資源庫:

vim /etc/yum.repos.d/nginx.repo  [nginx]  name=nginx repo  baseurl=http://nginx.org/packages/centos/$releasever/$basearch/  gpgcheck=0  enabled=1

三、安裝nginx

yum -y install nginx


四、測試nginx配置文件是否正確

nginx -t

打印如下:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

五、CentOS7.0+ nginx實現(xiàn)停止、啟動、重啟

systemctl stop nginx.service  systemctl start nginx.servicesystemctl restart nginx.servicesystemctl status nginx.service

開機(jī)自啟:

systemctl enable nginx.service

取消開機(jī)自啟:

systemctl disable nginx.service

六、nginx.conf配置示例

我的配置:

user nginx;worker_processes 4;error_log /var/log/nginx/error.log warn;pid    /var/run/nginx.pid;events {  worker_connections 1024;}http {  include    /etc/nginx/mime.types;  default_type application/octet-stream;  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 /var/log/nginx/access.log main;  sendfile    on;  #tcp_nopush   on;  keepalive_timeout 65;  #gzip on;  include /etc/nginx/conf.d/*.conf;  #設(shè)定負(fù)載均衡的服務(wù)器列表  upstream pay_server {    ip_hash;    server 10.74.248.01:8088 max_fails=2 fail_timeout=2;    server 10.74.248.02:8088 max_fails=2 fail_timeout=2;  }  upstream print_server {    ip_hash;    server 10.74.248.03:2001 max_fails=2 fail_timeout=2;    server 10.74.248.04:2001 max_fails=2 fail_timeout=2;  }  upstream accss_door_server {    ip_hash;    server 10.74.248.05:2002 max_fails=2 fail_timeout=2;    server 10.74.248.06:2002 max_fails=2 fail_timeout=2;  }    server {    listen 80;    server_name wab.kupu.ccoop.com.cn;    location /invengo {         proxy_pass http://pay_server;         index index.jsp index.html index.htm;    }    location /invengo/epc {         proxy_pass http://print_server;         index index.jsp index.html index.htm;    }    location /invengo/print {         proxy_pass http://print_server;         index index.jsp index.html index.htm;    }    location /checkout {         proxy_pass http://accss_door_server;         index index.jsp index.html index.htm;    }    location /asset {         proxy_pass http://accss_door_server;         index index.jsp index.html index.htm;    }  }
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 宁陕县| 东方市| 雷波县| 临西县| 晋州市| 樟树市| 聊城市| 阿克陶县| 蒙阴县| 吐鲁番市| 青河县| 南城县| 来宾市| 育儿| 台南县| 盐边县| 浙江省| 花莲县| 水富县| 隆回县| 辽宁省| 平塘县| 鸡泽县| 凭祥市| 成武县| 舟曲县| 棋牌| 昔阳县| 南充市| 商南县| 富顺县| 光山县| 鹤峰县| 长宁县| 舞钢市| 镇康县| 宣化县| 绍兴市| 麻江县| 屏山县| 南江县|