Ubuntu 配置多域名站点
思路 -- 跟Windows 一样
1添加Nginx 指向项目的入口 配置域名
2修改本地host文件域名指向
实现:
1 进入Nginx 配置文件 默认地址为
/etc/nginx/sites-enabled/
拷贝 default 文件一份 修改内容如下:(一个server就是一个域名配置)
server {
listen ; #端口
root /home/frings/Work/basic/web; #指向项目入口文件
index index.html index.htm index.nginx-debian.html index.php;
server_name basic.com;#域名自己设置
location / {
try_files $uri $uri/ =;
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $;
set $path_info $;
}
fastcgi_pass unix:/run/php/php7.-fpm.sock;
include /etc/nginx/fastcgi_params;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
}
server {
listen ;
root /home/frings/Work/basic/web;
index index.html index.htm index.nginx-debian.html index.php;
server_name basic1.com;
location / {
try_files $uri $uri/ =;
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $;
set $path_info $;
}
fastcgi_pass unix:/run/php/php7.-fpm.sock;
include /etc/nginx/fastcgi_params;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
}
2 修改host 域名指向 地址 /etc/hosts (注意后面有s)
127.0.0.1 localhost
127.0.1.1 ubuntu
127.0.0.1 basic.com #域名名称
127.0.0.1 basic1.com # The following lines are desirable for IPv6 capable hosts
:: ip6-localhost ip6-loopback
fe00:: ip6-localnet
ff00:: ip6-mcastprefix
ff02:: ip6-allnodes
ff02:: ip6-allrouters
0.0.0.0 account.jetbrains.com
Ubuntu 配置多域名站点的更多相关文章
- xamp配置多域名站点
xampp配置多站点出现,htdocs目录和虚拟目录二者只能选其一的情况,我的xampp安装在D:\xampp\,默认web根目录在D:\xampp\htdocs,然后我在D:\magento安装了m ...
- [记录] Ubuntu 配置Apache虚拟站点
版本 Ubuntu 16.04 1 . 首先找到Apapche配置文件夹 /etc/apache2/ apache2.conf conf-enabled magic mods-enabled sit ...
- Apache2配置多域名站点及支持https
0x00 预备条件 申请SSL证书 建立对应站点目录 开放443端口 0x01 配置sites-available文件 执行 vi /etc/apache2/sites-available/zecoc ...
- omcat配置多域名站点启动时项目重复加载多次
在tomcat中配置多个Host的时候, 出现项目重复启动多次的情况. 刚开始以为是spring boot发布项目的时候自带了一个tomcat引起的, 后来发现不是 参考了这两篇文章, 解决问题 ht ...
- 【Azure 环境】基于Azure搭建企业级内部站点, 配置私有域名访问的详细教程 (含演示动画)
前言 在Azure中,可以通过App Service快速部署,构建自定义站点(PaaS服务).默认情况下,这些站点被访问URL都是面向公网,通过公网进行解析.为了最好的安全保障,是否可以有一种功能实现 ...
- 使用Apache2配置多个站点
六 27 pache2主配置文件: /etc/apache2/apache2.conf.其最后两行为: # Include the virtual host configurations:Incl ...
- Jexus下配置多个站点
一.在jexus中一个配置文件就是一个站点,有多少个配置文件就可以创建多少个站点 配置文件所在的位置 在siteconf中有一个最基本的配置 default ##################### ...
- nginx配置基于域名、端口、IP的虚拟主机
1.基于域名的虚拟主机: 绝大多数企业对外提供服务的网站使用的都是基于域名的主机,通过不同的域名区分不同的虚拟主机. 首先我们进入安装nginxd的目录下:/application/nginx-1.6 ...
- Ubuntu 配置 Android 开发 环境
. 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...
随机推荐
- JS中的继承方式总结
1. 原型链继承(又称类继承) Child.prototype = new Parent(); function Parent (name, age) { this.name = name; this ...
- 进程状态转换及其PCB的变化
代码实现了模拟进程状态转换及其相应PCB内容.组织结构的变化. #include<iostream> using namespace std; typedef struct pcb{ in ...
- 腾讯云微信小程序域名变更指南
1 . 将域名添加到云解析里面, 将解析的地址指向已有的小程序负载均衡地址: https://console.qcloud.com/cns 将域名添加到解析列表 添加成功之后,点击解析按钮,添加二级域 ...
- how to determint wether two column equals
question: How to determint wether two column equals? Answer: Table one:RecordId = 1,CommonId = 5,Ap ...
- JSP简要
本篇知识导图 说起JSP,当年做课程设计什么的都用的这个,虽然技术比较古老,但是还是挺广泛使用的. JSP是一种前台的展现语言,在mvc里面属于表现层.它主要由静态,动态两部分组成,静态包括HTML, ...
- 给Sublime text 3增加选中当前单词快捷键
1.录制一份macro caret on a word –> ctrl+left –> ctrl+shift+right 2.将录制好的macro保存为select_current_wor ...
- 【转载】SSH login without password 免密登陆
Your aim You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic l ...
- 2018.11.28 OGNL表达式与struts2框架结合的体现---在配置文件中体现(补充)
Demo3Action配置 struts.xml 主配置文件配置 地址栏输入 http://localhost:8080/StrutsDay03/Demo3Action 对于主配置的文件参数而言,如果 ...
- 【iOS】那些年,遇到的小坑
'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjectsAndKeys:]: second ...
- response.Close、response.End、response.Flush区别
今天在做文件下载功能用到的是response的方法,首先我们要了解这些方法的作用. 1.response.write():将信息写入http响应输出流. 2.response.Flush:向客户端发送 ...