nginx简单配置
来源:互联网 发布:手机数据连接总是断开 编辑:程序博客网 时间:2024/06/05 19:00
nginx +tomcat
nginx 是web应用服务器,作为高性能服务器,拥有许多功能,反向代理,静态化,负载均衡等
今天实现对静态文件的配置
用nginx对请求进行处理,tomcat负责后台业务逻辑
首先,在linux安装nginx
yum install nginx
service nginx start
然后对nginx进行配置
vim /etc/nginx/conf.d/default.conf配置如下upstream tomcat_server{#配置虚拟主机 server localhost:8080;}server { listen 80 default_server;#监听的端口 #listen [::]:80 default_server; server_name localhost;#server名字 root /usr/file; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { root html; index index.html; } location ~ .*$ {#配置tomcat proxy_pass http://tomcat_server;#虚拟主机 proxy_set_header Host $host; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {#配置静态资源 root /usr/file; expires 30d; } location ^~ /static {#配置静态文件夹路径 alias /usr/file/static; } location ^~ /var { alias /var; }service nginx restart
访问路径就是host:80/tomcat的访问路径
在浏览器中可以看到nginx,代表配置成功!
阅读全文
0 0
- 【Nginx 配置】简单配置
- 简单的nginx配置
- nginx 缓存简单配置
- nginx + uwsgi简单配置
- nginx简单配置
- keepalived nginx简单配置
- nginx简单配置介绍
- nginx简单配置详解
- Nginx简单配置
- nginx简单配置
- Nginx+Tomcat简单配置
- nginx 简单配置
- Web Nginx简单配置
- 【Linux】Nginx简单配置
- nginx简单配置
- nginx简单配置
- nginx简单配置
- nginx+tomcat简单配置
- Windows 系统下配置 pyrouge
- 接口测试入门
- 系统测试——基础知识
- 459. Repeated Substring Pattern
- windows 配置不同版本JDK
- nginx简单配置
- 《C++ primer》读书规划 I
- Java8 Lambda表达式 函数式编程(转)
- Linux日常——PSH&URG,定时器,三次握手&四次挥手
- JDBC实现连接池
- 线性代数的本质-学习笔记3
- wamp自定义网站根目录
- 建站--静态页面vs动态网页
- wamp出现You don’t have permission to access/on this server提示