server {
listen 80;
server_name yy.test.cn;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/test1/;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
} server {
listen 80;
server_name www.test.cn;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/test2/;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
} server {
listen 80;
server_name www.demo.cn;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/demo1/;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}

由于本人的是linux服务器所以本服务器有三个域名  分别为两个主域名 和一个二级域名

配置方法: 在nginx.conf复制三份相同的sever{} 最后重启nginx即可

阿里云服务器怎么运行多个项目(Nginx)的更多相关文章

  1. 阿里云服务器晚上运行定时任务报Too many connections

    1. 相关查询连接数的命令 mysql>show variables like '%max_connections%'; +-------------------------+--------- ...

  2. Mxonline3.6 在阿里云服务器上的部署(uwsgi nginx)

    我的项目结构 1. 执行`python manage.py migrate`命令,将迁移文件,映射到数据库中,创建相应的表. 进入数据库 use mxonline数据库     source /hom ...

  3. 阿里云服务器部署php的laravel项目,在阿里云买ECS 搭建 Linux+Nginx+Mysql+PHP环境的

    在阿里云买ECS的时候选择自己习惯的镜像系统,我一般都是使用Linux Ubuntu,所以,以下的配置都是在Ubuntu 14.04稳定支持版的环境中搭建Linux+Nginx+Mysql+PHP环境 ...

  4. 基于阿里云服务器Linux系统部署JavaWeb项目

    前段时间刚完成一个JavaWeb项目,想着怎么部署到服务器上,边学边做,花了点时间终于成功部署了,这里总结记录一下过程中所遇到的问题及解决方法.之所以选择阿里云,考虑到它是使用用户最多也是最广泛的云服 ...

  5. javaWeb项目部署到阿里云服务器步骤 完整版

    记录web项目部署到阿里云服务器步骤 (使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以 ...

  6. blesta运行造成阿里云服务器CPU频繁超载的原因分析

    博主在阿里云服务器上安装了主机软件Blesta后,阿里云后台频繁提示CPU超载,打开突发性能模式后,发现CPU负载到了100%.如下图所示: 直接在putty里面reboot整个系统后,负载瞬间降为2 ...

  7. javaWeb项目部署到阿里云服务器步骤

    记录web项目部署到阿里云服务器步骤 (使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以 ...

  8. 小程序后端项目【Springboot框架】部署到阿里云服务器【支持https访问】

    前言: 我的后端项目是Java写的,用的Springboot框架.在部署服务器并配置https访问过程中,因为做了一些令人窒息的操作(事后发现),所以老是不能成功. 不成功具体点说就是:域名地址可以正 ...

  9. laravel项目使用appnode部署linux系统到阿里云服务器流程记录(待补充)

    使用 SSH 连接工具,如 PuTTY.XShell.SecureCRT 等,连接 Linux 服务器后(阿里云服务器命令行内直接输入appnode安装命令,版本:mysql选5.7.php选7.2) ...

随机推荐

  1. 水平方向的RecyclerView

    最近做了一个项目需要实现一个卡片式的水平滑动,但是不能手势滑动,点击卡片上的按钮之后滑动到下一个卡片,所以想到用RecyclerView实现,去掉它的手势滑动,点击按钮之后再代码控制滑动到下一个卡片. ...

  2. eclipse 更改官方配色

    打开Eclipse,help->Install new software, 输入 http://eclipse-color-theme.github.com/update,等待就OK了. 然后w ...

  3. ionic 的缓存 和局部刷新

    最近两天在做项目时,发现ionic的缓存功能非常方便好用,提高了再低端手机特别是android比较低版本上的流畅性!可是,后来发现,整体的缓存整个页面并不是一个一劳永逸的办法,结合局部刷新功能,感觉就 ...

  4. iOS内购图文流程(2017)

    什么是内购? 只要在iPhone App上购买的不是实物产品(也就是虚拟产品如qq币.虎牙币.电子书......) 都需要走内购流程,苹果这里面抽走三成.   使用内购需要走的流程. 1,填写协议,税 ...

  5. [Leetcode] DP -- Target Sum

    You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symb ...

  6. java 二叉树实现

    //二叉树,有左子数,右子树,小的值放到左边,大的值放到右边,左边有树的话继续这个过程,(以下为代部分,赋值的时候采用了递归的方式) package liaobiao;class BiTree{ pr ...

  7. 让textarea和附近的文字居中对齐

    textarea {display:inline-block;vertical-align:middle;}

  8. my97自定义事件

    onFocus="WdatePicker({onpicked:function(){alert(0);}})"

  9. 数据的ID名生成新的引用索引树

    <?php $arr= [ '0'=>[ "id"=>2, "name"=>"建材", "pid" ...

  10. php解决表单重复提交

    php解决表单重复提交时间:2015-2-28 | 评论:1条评论 | 被查看了 189 次 | 标签:php, W3cui重复提交是我们开发中会常碰到的一个问题,除了我们使用js来防止表单的重复提交 ...