nginx默认虚拟主机
2018-01-04 10:09
204 查看
vim /usr/local/nginx/conf/nginx.conf //删除server部分
增加
include vhost/*.conf //在conf下面创建一个vhost子目录
[root@localhost conf]# pwd
/usr/local/nginx/conf
mkdir vhost
cd vhost/
vim default.conf //加入如下内容
server
{
listen 80 default_server; // default_server有这个标记的就是默认虚拟主机
server_name aaa.com; //域名
index index.html index.htm index.php;
root /data/wwwroot/default; //网站根目录。Apache的是Document
}
mkdir -p /data/wwwroot/default/
echo “This is a default site.”>/data/wwwroot/default/index.html
/usr/local/nginx/sbin/nginx -t //检测语法
/usr/local/nginx/sbin/nginx -s reload //#重新加载
curl localhost
curl -x127.0.0.1:80 123.com
增加
include vhost/*.conf //在conf下面创建一个vhost子目录
[root@localhost conf]# pwd
/usr/local/nginx/conf
mkdir vhost
cd vhost/
vim default.conf //加入如下内容
server
{
listen 80 default_server; // default_server有这个标记的就是默认虚拟主机
server_name aaa.com; //域名
index index.html index.htm index.php;
root /data/wwwroot/default; //网站根目录。Apache的是Document
}
mkdir -p /data/wwwroot/default/
echo “This is a default site.”>/data/wwwroot/default/index.html
/usr/local/nginx/sbin/nginx -t //检测语法
/usr/local/nginx/sbin/nginx -s reload //#重新加载
curl localhost
curl -x127.0.0.1:80 123.com
相关文章推荐
- nginx 验证默认虚拟主机和用户认证(设置网站需要账号密码访问)
- Nginx安装,默认虚拟主机,Nginx用户认证,Nginx域名重定向
- LAMP架构(nginx安装,默认虚拟主机,用户认证,域名重定向,nginx配置文件详解)
- nginx简单防盗链及设置默认虚拟主机
- Nginx安装、默认虚拟主机、 Nginx用户认证、Nginx域名重定向
- Nginx安装、默认虚拟主机、用户认证、nginx中PHP解析
- Nginx默认虚拟主机、 Nginx用户认证、Nginx域名重定向、访问日志·····
- [转载]nginx简单防盗链及设置默认虚拟主机(禁止通过IP访问)
- Nginx安装,Nginx默认虚拟主机,Nginx用户认证,Nginx重定向
- 12.6 Nginx安装;12.7 Nginx默认虚拟主机;12.8 Nginx用户认证;12.9 Nginx域名重定向
- Nginx安装、默认虚拟主机、Nginx用户认证、Nginx域名重定向
- nginx默认虚拟主机
- 12.6 Nginx安装 12.7 默认虚拟主机 12.8 Nginx用户认证 12.9 Nginx域名重定向
- Nginx安装、默认虚拟主机、用户认证、域名重定向
- Nginx安装、默认虚拟主机 、Nginx用户认证、Nginx域名重定向
- Nginx介绍、Nginx安装、默认虚拟主机、用户认证、nginx中PHP解析
- nginx简单防盗链及设置默认虚拟主机
- LNMP架构 (2)之 Nginx安装、默认虚拟主机、用户认证、域名重定向、配置文件详解
- 为nginx设置默认虚拟主机(空主机头,默认主机头)
- Nginx安装、默认虚拟主机、用户认证、nginx中PHP解析