购买了阿里云机器,准备搭建一套备份的后台,由于资源有限所以将两个后台搭建到一组SLB下的两台WEB上。

使用软件:NGINX+PHP

root@xx conf.d]# yum install php-fpm nginx

更改nginx.conf文件,我将server信息全部注释,http下include到/etc/nginx/conf.d/*.conf下,这样清晰一些~

root@xx conf.d]# cat /etc/nginx/nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf; events {
worker_connections 1024;
} http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048; include /etc/nginx/mime.types;
default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf; #包含了我配置虚拟目录的文件 } [root@xx conf.d]#

在虚拟目录下创建了两个后台的.conf文件

[root@xx conf.d]# ll /etc/nginx/conf.d/
total 8
-rw-r--r-- 1 root root 516 Jul 24 13:54 aaa.com.conf
-rw-r--r-- 1 root root 556 Jul 24 13:55 bbb.com.conf
[root@xx conf.d]#

两个配置文件分别如下:

[root@xx conf.d]# cat bbb.com.conf
server {
listen 80;
server_name bbb.com;
root /letv/www/bbbz;
index index.html index.htm index.php;
location /abc/ {
index index.php;
if (!-e $request_filename){
rewrite ^/abc/(.*)$ /hotel/index.php?s=$1 last;
break;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
[root@xx conf.d]#

  

[root@xx conf.d]# cat aaa.com.conf
server {
listen 80;
server_name aaa.com;
root /letv/www/aaa;
index index.html index.htm index.php;
location /abc/ { #数据目录的匹配
index index.php;
if (!-e $request_filename){
rewrite ^/abc/(.*)$ /hotel/index.php?s=$1 last;
break;
}
}
location ~ \.php$ {            #正则表达php文件用fastcgi解析
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
[root@xx conf.d]#

  

测试 aaa.com  bbb.com  访问不通目录下的数据

最新文章

  1. Validation failed for one or more entities. See ‘EntityValidationErrors’解决方法
  2. HDU 2089 简单数位dp
  3. 关于async
  4. JavaScript实现冒泡排序、快速排序、插入排序
  5. PE查看器
  6. http://jingyan.baidu.com/article/7908e85c74d85faf491ad260.html
  7. 3D分析之Functional Surface工具箱(转)
  8. ImportError: No module named matlab
  9. [转]关于 Swift 的一点初步看法
  10. poj 1604 Just the Facts
  11. 201521123036 《Java程序设计》第13周学习总结
  12. javascript嵌套java实现jsp
  13. hMailServer 邮件服务器搭建
  14. React 体验
  15. jsonp获取股票信息
  16. putty登录显示IP
  17. poj 2125 Destroying The Graph (最小点权覆盖)
  18. 微信小程序开发中的二三事之网易云信IMSDK DEMO
  19. Zynq-7000 FreeRTOS(二)中断:PL中断请求
  20. UIImage 裁剪图片和等比列缩放图片

热门文章

  1. BZOJ1023: [SHOI2008]cactus仙人掌图(仙人掌dp)
  2. ABAP术语-Sales Order
  3. mysql 的基本操作总结--增删改查
  4. Python记录键盘鼠标敲击次数
  5. Java分布式锁之数据库方式实现
  6. canvas常用属性方法由浅下沉
  7. QOS-交换机拥塞管理
  8. st link 连接问题ST LINK is not in the DFU mode plesse restart it
  9. 关于 ssh 连接较慢的解决办法
  10. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误及解决