国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 桐庐县| 左权县| 竹溪县| 旺苍县| 寿光市| 铁力市| 洪泽县| 屏山县| 泗水县| 改则县| 宝清县| 扎囊县| 陆良县| 原平市| 平山县| 通河县| 巴林左旗| 嘉峪关市| 甘德县| 休宁县| 临沧市| 石首市| 波密县| 克东县| 从化市| 柳林县| 青岛市| 遵义市| 阳春市| 文成县| 逊克县| 仪征市| 丰镇市| 瓦房店市| 邯郸县| 芒康县| 上蔡县| 裕民县| 贺州市| 丹寨县| 延边|