zoukankan      html  css  js  c++  java
  • 手把手教你nginx/linux下如何增加网站

    先进入到nginx的配置文件目录
    请输入以下命令

    1. cd /alidata/server/nginx/conf/vhosts

    再输入

     
    1. ll

    看看是不是像下面截图的一样




    用神器xftp将default.conf.bak拖到本地,用文本编辑器打开。建议使用


    按照下图所示进行修改,设定好网站域名和网站目录。



    如果您需要配置针对该网站的伪静态规则,请设定好伪静态调用文件,并同时在rewrite目录放置好伪静态规则文件。如图所示。





    我们在rewrite目录下已经预设了部分常见程序的伪静态规则。




    例如如果您使用的是phpcms程序。只需将配置文件如下图所示进行修改。




    好了。都调整完毕!





    将文件另存一下,请注意图片所示参数设置




    再用xftp将文件上传到服务器上

    新建下网站目录

    1. mkdir -p /alidata/www/网站目录名

    下面测试下我们配置的文件是否正确吧

    输入

    1. /alidata/server/nginx/sbin/nginx -t




    看到了么?

    引用
    nginx: the configuration file /alidata/server/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /alidata/server/nginx/conf/nginx.conf test is successful

    如果出现以上两句话就说明配置成功了。下面重启下nginx

     
    1. /alidata/server/nginx/sbin/nginx -s reload

    恭喜您,网站配置完成!

     

    =============================================

     

    如何添加网站for linux(绑定域名)

    以下配置的路径以阿里云提供的标准环境路径为准,如果您另行安装,请根据实际安装路径配置。
     
    1.cd /alidata/server/httpd/conf/vhosts/ 进入绑定域名所在目录,
     
    2.vim test.conf  建立一个配置文件,test可以自己命名;
     
    3.点击字母“i”开始编辑文件,输入内容:
    <VirtualHost *:80>
            DocumentRoot /alidata/www/phpwind
            ServerName localhost
            ServerAlias localhost
            <Directory "/alidata/www/phpwind">
                Options -Indexes FollowSymLinks
                AllowOverride all
                Order allow,deny
                Allow from all
            </Directory>
            <IfModule mod_rewrite.c>
                    RewriteEngine On
                    RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
                    RewriteRule ^(.*)/simple/([a-z0-9\_]+.html)$ $1/simple/index.php?$2
            </IfModule>
            ErrorLog "/alidata/log/httpd/phpwind-error.log"
            CustomLog "/alidata/log/httpd/access/phpwind.log" common
    </VirtualHost>
     
    其中:
    ServerName www.test.com 绑定的网站域名
    ServerAlias test.com 绑定的网站别名(您如果有多个域名添加在这里)
    DirectoryIndex index.html index.php index.htm 设置默认首页
    DocumentRoot /alidata/www/test 和 Directory "/alidata/www/test" 都是指定网站的目录,需要一致。
     
    按“esc”退出编辑模式,输入“:wq”保存退出。
     
    4.输入命令:/alidata/server/httpd/bin/apachectl restart 重启apache测试。
     
    5.测试网站。请在浏览器中输入域名,测试设置。
  • 相关阅读:
    系统学Python-01
    pandas(二)
    matplotlib
    Python数据分析-初识numpy、pandas、scipy、matplotlib和Scikit-Learn等数据处理库
    Python进行读取或写入等文件操作时的路径问题
    pandas(一)
    00 Python及第三方库的安装问题
    sorted ()函数和列表中的sort()函数
    git 获取branch名和commit id
    查看Android log 和TEE Log
  • 原文地址:https://www.cnblogs.com/tonykan/p/3505881.html
Copyright © 2011-2022 走看看