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

首頁 > 網站 > Nginx > 正文

Linux環境下安裝Nginx及其使用

2024-08-30 12:23:51
字體:
來源:轉載
供稿:網友

一、查看CentOS的版本

cat /etc/redhat-release

二、添加資源庫

在 CentOS 系統上安裝 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實現停止、啟動、重啟

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

開機自啟:

systemctl enable nginx.service

取消開機自啟:

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;  #設定負載均衡的服務器列表  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;    }  }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汪清县| 乌海市| 云和县| 双柏县| 偏关县| 韶山市| 永丰县| 越西县| 酒泉市| 绍兴市| 会东县| 南漳县| 新巴尔虎左旗| 托克托县| 青州市| 卫辉市| 东台市| 朔州市| 武定县| 金山区| 洛川县| 彭泽县| 连平县| 满洲里市| 贵阳市| 饶阳县| 都匀市| 兴隆县| 迁安市| 瓮安县| 临沂市| 枝江市| 中方县| 道孚县| 浑源县| 汽车| 柳州市| 乐山市| 南宫市| 财经| 教育|