nginx环境搭建
nginx安装步骤
安装nginx
[root@insure opt]# yum install nginx
启动nginx
[root@insure opt]# service nginx start
Redirecting to /bin/systemctl start nginx.service
测试nginx是否安装成功
[root@insure opt]# wget http://127.0.0.1
---- ::-- http://127.0.0.1/
Connecting to 127.0.0.1:... connected.
HTTP request sent, awaiting response... OK
Length: (.6K) [text/html]
Saving to: ‘index.html’ %[==================================================================================================================================================================>] , --.-K/s in 0s -- :: ( MB/s) - ‘index.html’ saved [/]
nginx操作
查看安装目录
[root@insure nginx]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx..gz /usr/share/man/man3/nginx.3pm.gz
[root@insure nginx]# cd /etc/nginx/
[root@insure nginx]# ls
conf.d fastcgi.conf fastcgi_params koi-utf mime.types nginx.conf scgi_params uwsgi_params win-utf
default.d fastcgi.conf.default fastcgi_params.default koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default
添加前端启动的配置 vi nginx.conf
server {
listen default_server;
#listen [::]: default_server;
server_name _;
root /usr/share/nginx/html; # Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#主要配置这里
location / {
root /opt/dev/claimconf/dist;
index index.html index.html;
try_files $uri $uri/ @router;
} location @router {
rewrite ^.*$ /index.html last;
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 9000 default_server;
#listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /opt/dev/claimconf/dist;
index index.html index.html;
try_files $uri $uri/ @router;
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
修改完成保存 重启nginx
service nginx restart 或者nginx -s reload
由于带宽原因,有两台nginx,最外层一台配置为
添加配置文件vi /etc/nginx/conf.d/standardprod.conf
server
{
listen ;
server_name standardtest.insuresmart.com.cn; access_log /var/log/nginx/standardtest_access.log;
error_log /var/log/nginx/standardtest_error.log;
root html;
index index.html index.htm index.php; location / {
proxy_pass http://standardprod; 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;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffer_size 64k;
proxy_buffers 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ignore_client_abort on;
} }
在配置文件nginx.conf添加
upstream standardprod
{
server 172.16.120.193:;
}
此端口对应前端布置的nginx设置监听的端口
yum install -y unzip zip
nginx环境搭建的更多相关文章
- Linux下PHP+Nginx环境搭建
PHP+Nginx环境搭建 作者:王宇阳( Mirror )^_^ 参考文章: Nginx+PHP+MySQL安装参考 PHP源码安装经验 PHP源码环境搭建过程中常见问题 CentOS环 ...
- Nginx环境搭建与使用
一.背景 之前测试的项目前后端的"路由"(负责把前端发过来的请求转发到相应的后端服务上)要用Nignx来取代原来的tomcat的http server功能,做这个替换的原因是Nig ...
- Nginx 环境搭建 (windows)
Nginx 环境搭建 (windows) 资源 # nginx在线文档和支持 For online documentation and support please refer to nginx.or ...
- 【Nginx(一)】Centos下 Nginx环境搭建
Nginx环境搭建 系统环境: 腾讯云 Linux Centos7 1.下载nginx压缩包 ,上传到腾讯云服务器 http://nginx.org/en/download.html 或者使用dock ...
- Linux下.Net Core+Nginx环境搭建小白教程
前言 对于接触.Net Core的我们来说之前从未接触过Linux,出于资源和性能及成本的考虑我们可能要将我们的环境搬到Linux下,这对于我们从未接触过Linux的童鞋们来说很棘手,那么我今天将带你 ...
- Docker学习之——Node.js+MongoDB+Nginx环境搭建(一)
最近在学习Node.js相关知识,在环境搭建上耗费了不少功夫,故此把这个过程写下来同大家分享一下,今天我先来介绍一下Docker,有很多人都写过相关知识,还有一些教程,在此我只想写一下,我的学习过程中 ...
- 基于【 centos7】三 || 分布式文件系统FastDFS+Nginx环境搭建
1. FastDFS介绍 1.1 FastDFS定义 FastDFS是用c语言编写的一款开源的分布式文件系统.FastDFS为互联网量身定制,充分考虑了冗余备份.负载均衡.线性扩容等机制,并注重高可用 ...
- nginx 环境搭建(基于linux)
Nginx是一种服务器软件,故而其最主要.最基本的功能当然是可以与服务器硬件结合,让程序员可以将程序放在Nginx服务器上,将程序发布出去,让成千上万的网民可以浏览.除此之外,Nginx是一种高性能的 ...
- nginx----------linux下nginx环境搭建遇到的一些问题汇总(多域名配置,配置文件修改问题)
一.启动 cd usr/local/nginx/sbin ./nginx 二.重启 更改配置重启nginx kill -HUP 主进程号或进程号文件路径 或者使用 cd /usr/local/ngin ...
- Nginx学习---企业级nginx环境搭建
1.1. nginx安装环境 1.系统要求 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. 1-1 安装 GCC 源码安装nginx需要依赖gcc环境,需要 ...
随机推荐
- Arrow模块生成时间
import arrow def isLeapYear(years): ''' 通过判断闰年,获取年份years下一年的总天数 :param years: 年份,int :return:days_su ...
- 【读书笔记】iOS-微信公众平台搭建与开发揭秘
一,微信公众平台. 1,“再小的个体,也有自己的品牌”,这是微信公众平台的官方广告. 2,微信公众平台没有认证门槛,只需要一个邮箱和手持身份证照片.目前一个身份证号只可注册两个微信公众帐号. 二,LB ...
- tfs 禁止多人签出
好久没用tfs了,忘了怎么设置了,记录下 编辑----->高级
- 安卓开发_关于WebView加载页面空白问题
依据我自己的测试,发现有时候用APP打开网页的时候,有的网页加载成功之前需要很久,有的一下就出来了(比如百度) 当加载时间过长的情况下,这时候显示的是空白界面,其实不是代码问题,只是要打开的这个网页太 ...
- 简单的TabLayout+Fragment选项卡
TabLayout属性: app:tabIndicatorColor="#fff" //下方滚动的下划线颜色 app:tabIndicatorHeight="10dp& ...
- 使用apksigner对apk进行v2签名
最近进行三方安全测试,剩最后一个问题: 原因是我用360加固宝之后,又用了360Signer对apk进行二次签名,而360Signer是用v1方式对apk进行签名的,所以安全检测还是不通过. 下面给出 ...
- scrapy系列(四)——CrawlSpider解析
CrawlSpider也继承自Spider,所以具备它的所有特性,这些特性上章已经讲过了,就再在赘述了,这章就讲点它本身所独有的. 参与过网站后台开发的应该会知道,网站的url都是有一定规则的.像dj ...
- [20170705]理解linux su命令.txt
[20170705]理解linux su命令.txt --//我一般在维护时经常使用root用户登录,然后su - oracle 转到其他用户操作--//一般都加入 - 参数.这个已经成了条件反射.. ...
- openldap系列
openldap系列 阅读视图 系列介绍 openldap系列目录 1. 系列介绍 本系列文档大部分来自于郭大勇老师的<OpenLDAP实战指南>,少部分来自于互联网.所有文档均已经过本人 ...
- 洗礼灵魂,修炼python(38)--面向对象编程(8)—从算术运算符进一步认识魔法方法
上一篇文章了解了魔法方法,相信你已经归魔法方法至少有个概念了,那么今天就进一步的认识魔法方法.说这个之前,大脑里先回忆一下算术操作符. 什么是算术操作符?忘记没有?忘记了的自己倒回去看我前面的博文或者 ...