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 ...
随机推荐
- 解决问题E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)
在用sudo apt-get install 安装软件时,结果终端提示: “E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用) E: 无法锁定管理目录(/ ...
- 2k8 32bit下载
Windows Server 2008 32-bit Standard(标准版) Windows Server 2008 32-bit Enterprise(企业版) Windows Server 2 ...
- 玩转laravel5.4的入门动作(二)
做个文章的增删改查 第一步 把数据库的表结构建好,生成迁移 1 怎么建,当然是用php artisan命令了 使用 Artisan 命令 make:migration 来创建一个新的迁移: php ...
- zabbix监控系统日志
监控日志必须让agent运行在主动模式 参考网站:https://www.cnblogs.com/dadonggg/p/8611054.html?from=singlemessage
- delphi ios grid BindSourceDB bug
BindSourceDB4.DataSet :=nil; BindSourceDB4.DataSet :=FDMemTable1; grid绑定后显示数据正常,第二次赋值BindSourceDB4.D ...
- VB6单片机编程中的汉字处理
在DOS时代,拥有一个华丽的汉字菜单几乎是每个高档中文应用程序必须的包装.中文Windows操作系统的出现使得高级开发平台实现全中文的提示和界面非常容易和方便.在一般的应用程序中已经很少需要去专门考虑 ...
- body{font-size: 62.5%;} 解释
为什么body{font-size: 62.5%;} 2012-10-25 16:15 16778人阅读 评论(0) 收藏 举报 分类: css问题(17) 在网页设计中我们经常看见body{fo ...
- redis-trib.rb报错:/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- redis (LoadError)
报错如下: /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- redis ...
- express + mongodb 搭建一个简易网站 (五)
前面已经将导航中的“所有宝贝”页面连上了mongodb,现在我们就把其他的页面脸上数据库,将整个网站全部实现. 打开routes文件,找到jacket.js,将里面的代码修改如下: var expre ...
- 在制MO未取到FP2
描述:工单被过滤掉 IN_SFCHEADER表数据被删除掉 备份表监控可见数据是有写入IN_SFCHEADER表 删除前会将数据写入IN_SFCHEADER_TEMP表,发现物料编码是带了一个尾续CZ ...