http{
# 第一个虚拟主机
server {
listen 80;
server_name aaa.domain.com; #access_log logs/host.access.log main; location / {
root /usr/share/nginx/html/aaa;
index index.php index.html index.htm;
} error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
} # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html/aaa;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} } # 第二个虚拟主机
server
{
# 监听的IP和端口
listen 80;
# 主机名称
server_name bbb.otherdomain.com;
# 访问日志文件存放路径
access_log logs/bbb.otherdomain.com.access.log combined;
location /
{
# 默认首页文件,顺序从左到右,如果找不到index.html文件,则查找index.htm文件作为首页文件
index index.html index.htm;
# HTML网页文件存放的目录
root /usr/share/nginx/html/aaa;
}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#}
}

nginx配置多域名的更多相关文章

  1. Nginx配置同一个域名同时支持http与https两种方式访问

    Nginx配置同一个域名http与https两种方式都可访问,证书是阿里云上免费申请的 server{listen 80;listen 443 ssl;ssl on;server_name 域名;in ...

  2. 使用nginx配置二级域名

    使用nginx配置二级域名 2018.11.21 11:51:17字数 613阅读 170 最近想把三个项目配在一个服务器上,于是想使用nginx配置二级域名实现. 1.域名添加解析 我的是阿里云的域 ...

  3. nginx配置多域名映射方法(本地hosts)

    本地测试网站的时候如果不想用localhost/xxxx的形式访问,可能就需要修改hosts文件来映射了,但是一个网站还好,假如有多个网站的话就不行了. 这时就需要配置多域名映射 比如hosts中配置 ...

  4. nginx 配置 同一域名端口下,根据URL 导向不同的项目目录

    我们现在拥有2个项目.但是只有一个域名,通过nginx配置来实现以下url导向不同的项目. 后台管理台:{域名}/admin 用户客户端:{域名}/client server { listen 888 ...

  5. Nginx配置以及域名转发

    工程中的nginx配置 #user nobody; worker_processes 24; error_log /home/xxx/opt/nginx/logs/error.log; pid /ho ...

  6. nginx配置基于域名、端口、IP的虚拟主机

    1.基于域名的虚拟主机: 绝大多数企业对外提供服务的网站使用的都是基于域名的主机,通过不同的域名区分不同的虚拟主机. 首先我们进入安装nginxd的目录下:/application/nginx-1.6 ...

  7. nginx配置二级域名

    我在我的服务器上面跑了两个node应用程序,分别一个端口2368跑的是ghost博客,一个端口8000跑的是我的demo程序.想要一级域名zhangruojun.com用来访问博客,二级域名demo. ...

  8. Nginx配置多域名代理

    目的 当我们有多个站点需要对外网开放,每个站点的域名都不一样,然而我们只有一个外网ip.这种情况下,我们就可以使用一个Nginx来配置多域名代理.这种代理方式可以解决,在同一个端口上针对不同域名代理不 ...

  9. Laradock + tp5 + nginx 配置虚拟机域名始终跳转首页/502报错

    laradock默认配置文件如下: 配置运用于本地windows+phpstudy 部署的laravel项目未出现问题,如下: server { listen ; listen [::]:; serv ...

  10. nginx配置https域名

    nginx安装配置支持https和配置https域名 yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-de ...

随机推荐

  1. js 去空格 和 获得字节数

    function removespace(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } function getLength ...

  2. jenkins html报告不显示样式

    解决办法: 1.安装Startup Trigger,在jenkins节点启动时触发构建: 2.安装Groovy,直接运行Groovy代码: 3.新建一个Job,用于jenkins启动时执行配置命令: ...

  3. python-循环(while循环、for循环)

    循环:循环会重复执行循环体里面的代码,python中循环可分为while循环和for循环. break 不管循环有没有完成,立即结束循环 continue 结束本次循环,继续进行下一次循环 一.whi ...

  4. Ubuntu16.04搭建各种开发环境的IDE: QT5 , CodeBlocks ,eclipse-cdt, PyCharm

    搭建Ubuntu下C/C++以及Python的集成开发环境,采用双系统(Win7+Ubuntu)的Ubuntu16.04-LTS系统, 关于双系统的搭建可以参考下面博客(图文十分详细):https:/ ...

  5. Java_Ant详解(转载)

    Java_Ant详解   1,什么是antant是构建工具2,什么是构建概念到处可查到,形象来说,你要把代码从某个地方拿来,编译,再拷贝到某个地方去等等操作,当然不仅与此,但是主要用来干这个3,ant ...

  6. 【离散数学】 SDUT OJ 偏序关系

    偏序关系 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 给定有限集上二元关系的关系矩 ...

  7. echart在jsp中使用另外的方法

    var chartOutChar = null; var option1 = { tooltip: { trigger: 'axis' }, toolbox: { feature: { dataVie ...

  8. C++11 中的 Defaulted 和 Deleted 函数

    http://blog.jobbole.com/103669/ C++11 中的 Defaulted 和 Deleted 函数 2016/07/21 · C/C++, 开发 · C++ 分享到:3   ...

  9. promise的一个简单易懂实例

    Promise: <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  10. Android 程序调试技巧汇总

    1.Android Studio 引入一个项目作为library https://www.cnblogs.com/lixiangyang521/p/7453322.html 2.Android Stu ...