zoukankan      html  css  js  c++  java
  • 阿里云nginx创建多站点

    最近开始用阿里云的vps,用了它的一键安装包安装了php环境,nginx的。下面记录创建多站点的心得。

    首先php安装好后会自带安装一个phpwind的站点。

    文件目录存放在 /alidata/www 下

    配置文件是分开单独存放的,注意网上的很多都不准:

    phpwind的配置文件/alidata/server/nginx/conf/vhosts/phpwind.conf

    然后是在/alidata/server/nginx/conf/nginx.conf中调用 phpwind.conf文件 是通过 nginx.conf的include /alidata/server/nginx/conf/vhosts/*.conf;这一句

    然后我们新增站点:例如pro1

    站点文件存放在  /alidata/www 下

    新增pro1的配置文件 pro1.conf

     1 server {  
     2 listen 80;  
     3 server_name local.pro1.com;   
     4 #charset koi8-r;  
     5 #access_log logs/host.access.log main;  
     6 location / {  
     7 root /alidata/www/pro1;  
     8 index index.html index.htm;  
     9 }  
    10 #error_page 404 /404.html;  
    11 # redirect server error pages to the static page /50x.html  
    12 #  
    13 error_page 500 502 503 504 /50x.html;  
    14 location = /50x.html {  
    15 root html;  
    16 }  
    17 }  

    将pro1.conf 放在/alidata/server/nginx/conf/vhosts 下

    重启nginx /etc/init.d/nginx start/stop/restart/reload 注意这里是让你选的   /etc/init.d/nginx restart 重启

    然后配置本地host 就可以查看你新建的站点了 

  • 相关阅读:
    [luogu5665]划分
    [luogu5666]树的重心
    [bzoj1854]游戏
    [bzoj1853]幸运数字
    [bzoj2245]工作安排
    [bzoj1426]收集邮票
    [bzoj2396]神奇的矩阵
    [bzoj1858]序列操作
    [bzoj1863]皇帝的烦恼
    [bzoj1432]Function
  • 原文地址:https://www.cnblogs.com/webskill/p/4584378.html
Copyright © 2011-2022 走看看