lnmp vhost 虚拟目录配置
以前常用Windows 很熟悉,lnmp 配置虚拟目录也很简单。
安装完lnmp环境之后,在nginx的配置文件夹下,我采用的方法是复制default.conf 然后重命名为vhost_a.conf 文件/vhost_b.conf

当然里面的root 网站目录要设置一下:
vhost_a.conf:
server {
listen ;
server_name b.caesar.com;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html/b/;
index index.html index.htm index.php;
}
#error_page /.html;
# redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html/b;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~ \.php$ {
root /usr/share/nginx/html/b;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
vhost_b.conf:
server {
listen ;
server_name b.caesar.com;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html/b/;
index index.html index.htm index.php;
}
#error_page /.html;
# redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html/b/;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~ \.php$ {
root /usr/share/nginx/html/b/;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
然后nginx.conf 默认加载conf.d 文件夹下的所有后缀名为.conf的文件。所以不用修改nginx.conf
include /etc/nginx/conf.d/*.conf;
然后修改服务器的hosts 文件,将域名添加进去。
vi /etc/hosts
然后在html 目录下创建你的 a,b 目录
然后~nginx重新加载配置文件,或者restart
/etc/init.d/nginx restart
根据你服务器自己的配置进行重启,
然后如果域名是虚拟的病没有解析,注意要自己的电脑加上hosts
lnmp vhost 虚拟目录配置的更多相关文章
- Tomcat热部署和虚拟目录配置
1.Tomcat如何配置热部署 默认就是 <Host appBase="webapps" autoDeploy="true" name="loc ...
- TOMCAT服务器不写端口号、不写项目名访问项目、虚拟目录配置
一.不写端口. 这个问题都被问烂了,因为TOMCAT默认的访问端口为8080,而TCP/IP协议默认80端口访问,大家之所以看到别的网站都不写端口号是因为人家用的的80端口访问的,而80端口因为的TC ...
- tomcat虚拟目录配置
Tomcat6.0虚拟目录配置[转] 设虚拟目录 "site",通过 http://localhost:8080/site 访问物理路径 D:"site 文件夹里面的内容 ...
- 在apache虚拟目录配置
在apache虚拟目录配置中 <VirtualHost *:80>xxx xxx xxx</VirtualHost> 不能写成 <VirtualHost *>xxx ...
- Tomcat常见问题[内存溢出,虚拟目录配置等](一)
一.Tomcat内存溢出的解决方法 内存溢出一般有如下三种常见的原因: OutOfMemoryError: Java heap space OutOfMemoryError: PermGen spac ...
- apache虚拟目录配置实例
apache虚拟目录配置实例 一.首先,开启虚拟主机配置 在文件httpd.conf中找到: include conf/extra/httpd-vhosts.conf #开启 二.对httpd-vho ...
- ubuntu下lnmp添加虚拟目录没有权限
lnmp.org下载的lnmp集成环境,通过lnmp vhost tsp创建了虚拟主机目录,将此目录导入到phpstorm中时提示错误,应该时权限的问题,想通过chmod -R 777 tsp来改变t ...
- Tomcat虚拟目录配置方法及原理
tomcat 安装好之后,只需要把你的程序包放到$Tomcat_Home$/webapps下就可以直接使用了.这样会使webapps越来越大就需要设置虚拟目录: 1.单个应用设置: 在<Host ...
- tomcat虚拟主机虚拟目录配置
今天着实要记上一笔,需要配置tomcat虚拟目录的问题 一 首先看两个名词 appBase -- 顾名思义 就是你app所在的目录,目录下面的子目录将自动被部署为应用:war被解压并部署 docBas ...
随机推荐
- UVA-10115
字符查找替换,WA了N次,一次只能替换一个,下一次find必须从第0个位置开始 import java.io.File; import java.io.FileNotFoundException; i ...
- filzilla
之前找了一套支援 SFTP (FTP over SSH) 的 FTP Server 就是為了解決 Port 不夠用的問題,直到最近才發現我們常用的 FileZilla Server 原來就有支援 FT ...
- spring boot 整合MongoDB
参考 https://www.cnblogs.com/nbfujx/p/7999171.html
- leetcode83
/** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNo ...
- word 2013 自动保存太慢,下面读条起码3分钟
该问题有可能是应用干扰或者安全设置问题导致的. 建议您尝试以下方法: 方法一: 尝试使用干净启动来暂时禁用计算机启动时所加载的第三方程序来进一步做测试: 如何在Windows 中执行干净启动步骤 具体 ...
- VB6 让程序结束后带有返回值
第三方命令行程序运行完之后,批处理中可以随时通过errorlevel变量收取运行结果.而VB写的控制台程序却没有提供这样的功能.关于让控制台程序返回值的教程是本博客独家放出. 返回值,其实也就是进程的 ...
- 机器学习入门-数值特征-数字映射和one-hot编码 1.LabelEncoder(进行数据自编码) 2.map(进行字典的数字编码映射) 3.OnehotEncoder(进行one-hot编码) 4.pd.get_dummies(直接对特征进行one-hot编码)
1.LabelEncoder() # 用于构建数字编码 2 .map(dict_map) 根据dict_map字典进行数字编码的映射 3.OnehotEncoder() # 进行one-hot编码 ...
- 一个js程序:离下一个圣诞节还有多少天?
话不多说上代码: //离下一个圣诞节还有多少天 var christ=new Date(); christ.setMonth(11); christ.setDate(25); var year=now ...
- linux多路径配置
一.什么是多路径 普通的电脑主机都是一个硬盘挂接到一个总线上,这里是一对一的关系.而到了有光纤组成的SAN环境,或者由iSCSI组成的IPSAN环境,由于主机和存储通过了光纤交换机或者多块网卡及IP来 ...
- 关于str.split(",")中间 什么时候该加\\转义
java 分割符,对于某些符号的分割符进行切割的时候需要加转义字符,我贴上例子 1. package test1; public class split { public static void ma ...