linux服务器怎么添加站点,如何增加站点或虚拟主机及文件说明
发布日期:2021-06-24 11:19:54 浏览次数:3 分类:技术文章

本文共 967 字,大约阅读时间需要 3 分钟。

有两种方式

一个是直接加在配置文件后面,如

/www/wdlinux/nginx/conf/nginx.conf

/www/wdlinux/apache/conf/httpd-vhost.conf

一个是将每个域名或虚拟主机独立为一个文件,放在如下的目录(注意,文件尾要以.conf为名,如www.wdlinux.cn.conf)

nginx的虚拟主机配置文件目录 /www/wdlinux/nginx/conf/vhost

apache的虚拟主机配置文件目录 /www/wdlinux/apache/conf/vhost

然后保存重起相应服务即可,如

service nginxd restart

service httpd restart

apache的虚拟主机配置格式

DocumentRoot "/www/web/wdlinux"

ServerName wdlinux.cn

ServerAlias www.wdlinux.cn

ErrorLog "logs/wdlinux.cn-error_log"

CustomLog "logs/wdlinux.cn-access_log" common

nginx的虚拟主机配置格式

server {

listen       80;

server_name  wdlinux.cn;

root /www/web/wdlinux;

index  index.html index.php index.htm wdlinux.html;

location ~ \.php$ {

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

include fcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

expires      1d;

}

location ~ .*\.(js|css)?$ {

expires      12h;

}

}

上面的格式,域名和目录,根据自己的情况来修改

CentOS精简版,集成lamp,lnmp版,wdcp,wdcdn,wddns,一键安装包,集群负载均衡LVS,智能DNS/CDN,性能优化

本文连接:http://www.wdlinux.cn/old/node/121

转载地址:https://blog.csdn.net/weixin_32467421/article/details/116583315 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:linux系统输入指令,Linux系统基础 - 基本操作命令
下一篇:jmeter运行linux命令行,Jmeter在linux上运行(命令行运行Jmeter)

发表评论

最新留言

很好
[***.229.124.182]2024年04月17日 14时26分29秒