先进入到nginx的配置文件目录
请输入如下命令php
- cd /alidata/server/nginx/conf/vhosts
再输入html
看看是否是像下面截图的同样

用神器xftp将default.conf.bak拖到本地,用文本编辑器打开。建议使用
按照下图所示进行修改,设定好网站域名和网站目录。

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

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

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

好了。都调整完毕!

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

再用xftp将文件上传到服务器上
新建下网站目录linux
- mkdir -p /alidata/www/网站目录名
下面测试下咱们配置的文件是否正确吧
输入nginx
- /alidata/server/nginx/sbin/nginx -t

看到了么?apache
引用
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
若是出现以上两句话就说明配置成功了。下面重启下nginxvim
- /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.测试网站。请在浏览器中输入域名,测试设置。