linux nginx配置多个网站
1.建立wwwroot(/home/wwwrooot)
另建立一个wwwroot/test/index.html(网站目录)
2.建立vhost文件(/usr/local/nginx/conf/vhost)
3.配置nginx.conf,加入:include vhost/*.conf;
http{
......
include vhost/*.conf; // 注意这里是放在http{}里面,而不是外面
}
另配置vhost/test.conf
server {
listen ;
server_name test.zhouzhongjie.com;
root /home/wwwroot/test;
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server_name:下划线,域名,ip,localhost
server_name: _
server_name: xxx.com
server_name: 22.22.22.22
server_name:localhost // 不推荐这种
server
{
listen 8001;
#listen [::]:80;
server_name localhost;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwrooot/test; #include other.conf;
#error_page 404 /404.html; # Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } #include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
} location ~ .*\.(js|css)?$
{
expires 12h;
} location ~ /.well-known {
allow all;
} location ~ /\.
{
deny all;
} access_log off;
}
修改配置文件后需要重新加载
./nginx -s reload
最后重启nginx,
linux nginx配置多个网站的更多相关文章
- linux nginx 配置php
linux nginx 配置php 下载php源码 解压 configure ./configure --prefix=/usr/local/php --enable-fpm --with-mcr ...
- linux nginx配置新项目加域名(设置绑定域名)
转自:linux nginx配置新项目加域名 找到nginx的配置文件 nginx/nginx.conf 第一种方,法直接在nginx.com里面配置 user www www; worker_pro ...
- Linux Debian 7部署LEMP(Linux+Nginx+MySQL+PHP)网站环境
我们在玩VPS搭建网站环境的时候,都经常看到所谓的LAMP.LNMP.LEMP,LAMP, 其中的A代表APECHE WEB驱动环境,LNMP中的N代表NGINX驱动环境,只不过海外的叫法NGINX ...
- Linux - Nginx配置反向代理。
Nginx配置反向代理. 准备两台服务器 http://192.168.70.66 http://192.168.70.62 设置正则匹配(192.168.70.66) vim /usr/local/ ...
- linux nginx 配置ssl证书访问
http://www.linuxidc.com/Linux/2013-08/88271.htm 一.什么是 SSL 证书,什么是 HTTPSSSL 证书是一种数字证书,它使用 Secure Socke ...
- Linux nginx 配置 location 语法 正则表达式
location语法:location [=|~|~*|^~] /uri/ { - }默认:否上下文:server这个指令随URL不同而接受不同的结构.你可以配置使用常规字符串和正则表达式.如果使用正 ...
- Nginx配置HTTPS证书网站
前提: 1.主机需要先安装openssl 2.编译安装nginx时,要加上--with-http_ssl_module 这个ssl模块 现在开始配置:(我当时配置时,主机已安装了openss ...
- linux nginx配置新项目加域名
找到nginx的配置文件 nginx/nginx.conf 第一种方,法直接在nginx.com里面配置 user www www; worker_processes auto; error_log ...
- [Linux] Nginx服务下统计网站的QPS
单位时间的请求数就是QPS,那么在nginx服务的网站下,如果要统计QPS并且按从高到低排列,需要使用awk配合sort进行处理awk做的主要工作是把access每行日志按分隔符分开,然后循环每一行, ...
随机推荐
- 进入Linux救援(rescue)模式的四大法门
原文:http://blog.51cto.com/xxrenzhe/1272838 适用场景: 当误操作修改系统启动文件/etc/fstab, /etc/rc.d/rc.sysinit时,就会造成系统 ...
- JAVA-数据库之删除记录
相关资料:<21天学通Java Web开发> 删除记录 Statementdelete.jsp <%@ page language="java" contentT ...
- JAVA-JSP内置对象之out对象
相关资料:<21天学通Java Web开发> out对象1.out对象用来向网页输出信息. 方法 返回值 方法说 ...
- C# 裁剪图片
/// <summary> /// 生成缩略图 /// </summary> /// <param name="originalImagePath"& ...
- 阿里云安装elastcsearch后外网访问配置
内存 elastcsearch需要的内存是2G,可以修改/etc/elasticsearch/jvm.options,Xms和Xmx,建议分配更多的内存 外网访问 修改 /etc/elasticsea ...
- DeepNLP的核心关键/NLP词的表示方法类型/NLP语言模型 /词的分布式表示/word embedding/word2vec
DeepNLP的核心关键/NLP语言模型 /word embedding/word2vec Indexing: 〇.序 一.DeepNLP的核心关键:语言表示(Representation) 二.NL ...
- 微服务之springCloud-docker-feign配置(五)
简介 上一节我们讨论了怎么用feign声明式调用cloud的生产者,这节我们讨论一下feign配置,通过编写配置类,我们可以自定义feign的日志级别,日志扫描目录,可以通过feign调用服务在eur ...
- Winform仿制QQ微信聊天窗口气泡
因为公司业务原因,不能上传原始项目,这是简化版本. 临时设计的窗体和气泡样式,有需要可以重新设计.效果如下: 主要原理:一个TextBlock + 一个三角形 项目结构: -- Form1 窗体类 - ...
- select 操作选中添加、删除操作Javascript
//添加选中项 function addItem() { var myMember = document.getElementById("myMember"); var other ...
- TP v5中Url Compat模式
compatible 对于配置pathinfo的支持,在Nginx作服务器.无数种系统要同时运行的环境,实在是一项很累赘的事情,而又不想很low的多个参数(像m.c.a)构造路由参数,我需要那种不必强 ...