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每行日志按分隔符分开,然后循环每一行, ...
随机推荐
- redis集群主流架构方案分析
Redis在互联网大数据平台有着广泛的应用,主要被用来缓存热点数据,避免海量请求压垮数据库,同时可以提升服务节点的响应速度和并发量.随着数据量的增多,由于redis是占用单台物理机或虚机的内存,内存资 ...
- Node.js学习笔记(2)--提交表单
说明(2017-5-2 11:42:33): 1. index.html <!DOCTYPE html> <html lang="en"> <head ...
- splitter 使用
splitter1.Width = ; splitter1.Height = ; Label l = new Label(); l.Text = "···"; //写入的字,具体指 ...
- 实验吧 web题writeup
1.http://ctf5.shiyanbar.com/web/wonderkun/web/index.html 用户名我输入:or'xor"and"select"uni ...
- java结合js获取验证码
框架springmvc 1.后台java代码: package com.fh.controller.system.secCode; import java.awt.Color; import java ...
- 【转】Lombok:让JAVA代码更优雅
原文地址:http://blog.didispace.com/java-lombok-1/ 关于Lombok,其实在网上可以找到很多如何使用的文章,但是很少能找到比较齐全的整理.我也一直寻思着想写一篇 ...
- 认知计算 Cognitive Computing
认知计算代表一种全新的计算模式,它包含信息分析,自然语言处理和机器学习领域的大量创新技术. Cognnitive computing refers to systems that learn at s ...
- postgresql with递归
在PostgreSQL里,with子句提供了一种方法写一个大的查询中使用的辅助报表与查询.它有助于打破复杂和大型查询简单易读的形式. 1. 建表 postgres=# create table tb9 ...
- Sahi (3) —— 压力测试Load Test以CAS SSO登陆场景为例(103 Tutorial)
Sahi (3) -- 压力测试Load Test以CAS SSO登陆场景为例(103 Tutorial) jvm版本: 1.8.0_65 sahi版本: Sahi Pro 6.1.0 参考来源: S ...
- c# comboBox输出图文效果
核心代码:重写DrawItem事件 void Event_CboDrawItem(object sender, DrawItemEventArgs e) { ) return; var cbo = s ...