Linux服务器如何绑定域名?

Linux服务器如何绑定域名?,第1张

1、首先用putty远程登录服务器

2、进入此文件夹。cd /var/www/conf/ 编辑httd.confi文件vi httpd.conf,然后按I,进入编辑模式,修改如下参数:

例如:

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot /www/docs/dummy-host.example.com

erverName v7o.cn   #如果要修改主域名,修改此处域名并保存即可。

ErrorLog logs/dummy-host.example.com-error_log --记录错误日志文件路径

CustomLog logs/dummy-host.example.com-access_log common--客户访问日志路径

</VirtualHost>

如果要添加一个域名,添加ServerAlias字段即可。如添加abc123.com作为网站的第二个域名:

<VirtualHost *:80>

ServerAdmin webmaster@dummy-host.example.com 

DocumentRoot /www/docs/dummy-host.example.com

ServerName v7o.cn

ServerAlias v7o.cn

ErrorLog logs/dummy-host.example.com-error_log --记录错误日志文件路径

CustomLog logs/dummy-host.example.com-access_log common--客户访问日志路径

</VirtualHost>

3、重启服务

# /var/www/bin/apachectl restart

修改完毕保存配置文件,需重启apache才能生效。

Nginx多域名配置 一、环境准备 1.Tengine,也称Taobao nginx,淘宝在Nginx基础上,针对大型网站访问,添加了一些高级功能和特性。 2.Resin服务器或者Tomcat服务器,用来做Web服务器 二、域名解析 假设虚拟主机外网IP是123.123.123.123,添加解析到该域名: 1.添加域名解析,@和www,分别对应tngtech.co

etc/hosts 文件的具体内容如下: # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost fc4 192.168.1.3 a.test.com a 192.168.1.1 b.test.cn b /etc/host.conf 文件: order hosts,bind 表示先用hosts文件做解析,在用DNS解析 /etc/resolv.conf 文件: generated by NetworkManager, do not edit! search test.com nameserver 127.0.0.1 search test.cn nameserver 192.168.1.1 nameserver 61.144.56.100 /etc/named.conf 文件: // // named.conf for Red Hat caching-nameserver // options { directory "/var/named" dump-file "/var/named/data/cache_dump.db" statistics-file "/var/named/data/named_stats.txt" /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53 } // // a caching only nameserver config // controls { inet 127.0.0.1 allow { localhost} keys { rndckey} } zone "." IN { type hint file "named.ca" } zone "test.com"IN { type master file "test.com" allow-update { none} } zone "1.168.192.in-addr.arpa"IN { type master file "192.168.1.rev" allow-update { none} } zone "test.cn"IN { type master file "test.cn" allow-update { none} } zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { type master file "named.ip6.local" allow-update { none} } zone "255.in-addr.arpa" IN { type master file "named.broadcast" allow-update { none} } zone "0.in-addr.arpa" IN { type master file "named.zero" allow-update { none} } include "/etc/rndc.key" 在/var/name/test.com 文件下: $TTL 86400 @ IN SOA a.test.com. root.a.test.com ( 42 serial (d. adams) 3H refresh 15M retry 1W expiry 1D ) minimum IN NS a.test.com. IN MX 10 mail.test.com. a IN A 192.168.1.3 mail IN A 192.168.1.3 //其中root.a.test.com的含义是管理员的邮箱 /var/name/test.cn 文件下: $TTL 86400 @ IN SOA b.test.cn. root.a.test.com ( 42 serial (d. adams) 3H refresh 15M retry 1W expiry 1D ) minimum IN NS b.test.cn. IN MX 10 mail.test.cn. b IN A 192.168.1.1 mail IN A 192.168.1.1 /var/name/192.168.1.rev 文件下: $TTL 86400 @ IN SOA 1.168.192.in-addr.arpa. root.test.com. ( 1997022700 Serial 28800 Refresh 14400 Retry 3600000 Expire 86400 ) Minimum IN NS a.test.com. IN NS b.test.cn. IN MX 10 mail.test.com. IN MX 10 mail.test.cn. 3 IN PTR a.test.com. 3 IN PTR mail.test.com. 1 IN PTR b.test.cn. 1 IN PTR mail.test.cn. 然后用/etc/init.d/named restart重启DNS服务,在重启过程中,我曾经出现过好几次的错误,按照出错的提示,会提示是named.conf文件第几行出错的。或者提示在那些包含文件例如test.cn这些文件里面的问题,然后一个一个排除。 最后还有一些nslookup的命令比较有用: set all用于显示使用nslookup工具这台机器上的DNS服务器的一些信息 set type=any会显示完整信息包括域中邮件服务器和主从DNS服务器的名字和IP地址 server 192.168.0.1更换查询的DNS服务器地址。


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/182707.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-28
下一篇2023-03-28

发表评论

登录后才能评论

评论列表(0条)

    保存