Tag:redhat

Tag (redhat)'s result:

redhat6配置dns服务器

具体步骤如下: etc/named.conf配置 // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. //   options { listen-on port 53 { 10.0.165.253; }; listen-on-v6 port 53 { ::1; }; directory  “/var/named”; dump-file  “/var/named/data/cache_dump.db”; statistics-file “/var/named/data/named_stats.txt”; memstatistics-file “/var/named/data/named_mem_stats.txt”; allow-query     { localhost; }; recursion yes;   dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto;   /* Path to ISC DLV key */ bindkeys-file “/etc/named.iscdlv.key”;   managed-keys-directory “/var/named/dynamic”; };   logging { channel default_debug { file “data/named.run”; severity dynamic; }; };   zone “zhengxialsa.com” { type master; file “zhengxialsa.com”; };   zone “165.0.10.in-addr.arpa” { type master; file “165.0.10”; };   include “/etc/named.rfc1912.zones”; include “/etc/named.root.key”; 正向解析文件zhengxialsa.com配置 $TTL 86400 zhengxialsa.com.   IN     SOA       dns.zhengxialsa.com. root.zhengxialsa.com ( 20100820          ;serial 1H                ;refresh 15M               ;retry 1W                ;expire 1D)               ;minimun   zhengxialsa.com.   IN      NS         dns.zhengxialsa.com. dns                IN      A          10.0.165.253 lsa                IN      A          10.0.165.253 lsb                IN      A          10.0.165.253 lsc                IN      A          10.0.165.253 反向解析文件165.0.10配置 $TTL 86400 @       IN          SOA        165.0.10.in-addr.arpa.    root.zhengxialsa.com ( 20100820                  ;serial 1H                        ;refresh 15M                       ;retry 1W                        ;expire 1D)                       ;minimun   @       IN           NS         dns.zhengxialsa.com. 253     IN           PTR        dns.zhengxialsa.com. 253     IN           PTR        lsa.zhengxialsa.com. 253     IN           PTR        lsb.zhengxialsa.com. 253     IN           PTR        lsc.zhengxialsa.com. Resolve.conf配置 # Generated by NetworkManager nameserver 10.0.165.253   启动 service named start [root@localhost Desktop]# service named restart Stopping named: .                                          [  OK  ] Starting named:                                            [  OK  ]   测试 [root@localhost Desktop]# ping dns.zhengxialsa.com PING dns.zhengxialsa.com (10.0.165.253) 56(84) bytes of data. 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=1 ttl=64 time=0.063 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=2 ttl=64 time=0.094 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=3 ttl=64 time=0.203 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=4 ttl=64 time=0.095 ms   [root@localhost Desktop]# ping lsc.zhengxialsa.com PING lsc.zhengxialsa.com (10.0.165.253) 56(84) bytes of data. 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=1 ttl=64 time=0.044 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=2 ttl=64 time=0.094 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=3 ttl=64 time=0.095 ms 64 bytes from lsa.zhengxialsa.com (10.0.165.253): icmp_seq=4 ttl=64 time=0.094 ms ^C   [root@localhost Desktop]# ping lsa.zhengxialsa.com PING lsa.zhengxialsa.com (10.0.165.253) 56(84) bytes of data. 64 bytes from dns.zhengxialsa.com (10.0.165.253): icmp_seq=1 ttl=64 time=0.068 ms 64 bytes from dns.zhengxialsa.com (10.0.165.253): icmp_seq=2 ttl=64 time=0.095 ms 64 bytes from dns.zhengxialsa.com (10.0.165.253): icmp_seq=3 ttl=64 time=0.094 ms   [root@localhost Desktop]# ping lsb.zhengxialsa.com PING lsb.zhengxialsa.com (10.0.165.253) 56(84) bytes of data. 64 bytes from lsc.zhengxialsa.com (10.0.165.253): icmp_seq=1 ttl=64 time=0.089 ms 64 bytes from lsc.zhengxialsa.com (10.0.165.253): icmp_seq=2 ttl=64 time=0.081 ms 64 bytes from lsc.zhengxialsa.com (10.0.165.253): icmp_seq=3 ttl=64 time=0.084 ms 64 bytes from lsc.zhengxialsa.com (10.0.165.253): icmp_seq=4 ttl=64 time=0.095 ms 全部正常    

redhat下配置http服务器

0x00 概述 以前做的一个实验,完成了在redhat下配置http服务器,并实现改变端口,域名代替ip等操作,有需要的可以参考一下。   0x01 改变端口号 [root@mail Desktop]# service httpd status httpd (pid  4952) is running… 用ip直接访问网站,默认80端口 改变端口号,改成8888 80已经无法访问 成功访问 具体配置 [root@mail Desktop]# yum -y install policycoreutils-python yum whatprovides /usr/sbin/semanage or yum provides /usr/sbin/semanage [root@mail Desktop]# semanage port -l|grep http http_cache_port_t              tcp      3128, 8080, 8118, 8123, 10001-10010 http_cache_port_t              udp      3130 http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443 pegasus_http_port_t            tcp      5988 pegasus_https_port_t           tcp      5989 没8888 [root@mail Desktop]# semanage port -a -t http_port_t -p tcp 8888 [root@mail Desktop]# semanage port -l|grep http http_cache_port_t              tcp      3128, 8080, 8118, 8123, 10001-10010 http_cache_port_t              udp      3130 http_port_t                    tcp      8888, 80, 443, 488, 8008, 8009, 8443 pegasus_http_port_t            tcp      5988 pegasus_https_port_t           tcp      5989 搞定!也可以使用关闭selinux来改变端口(不太安全)   0x02 域名代替ip 域名:www.gdhy.col 具体操作: 向正向解析文件加入一条A记录 $TTL 86400 gdhy.col.   IN     SOA       dns.gdhy.col.                      root.gdhy.col ( 20100820                    ;serial 1H                          ;refresh 15M                         ;retry 1W                          ;expire 1D)                         ;minimun   gdhy.col.   IN     NS                 dns.gdhy.col. dns                IN      A          10.0.165.253 @                  IN      MX         10          mail.gdhy.col. mail               IN      A          10.0.165.253 www                IN      A          10.0.165.253   修改httpd.conf的servername的值 # ServerName www.gdhy.col:8888 搞定!   0x03 配置虚拟主机 1. 基于ip 只有1个内网ip,算了 大概配置就这样: <VirtualHost 10.0.165.252:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/html/vt1 DirectoryIndex index.html ServerName www.vvtt1.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>   <VirtualHost 10.0.165.251:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /var/www/html/vt2 DirectoryIndex index.html ServerName www.vvtt2.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> 2. 基于域名 通过www.vvtt1.com和www.vvtt2.com可以分别访问不同目录和主页 具体步骤: 配置正向解析文件,在named.comf加入这两个域zone $TTL 86400 vvtt2.com.   IN     SOA       dns.vvtt2.com.                      root.vvtt2.com ( 20100820                    ;serial 1H                          ;refresh 15M                         ;retry 1W                          ;expire 1D)                         ;minimun   vvtt2.com.   IN     NS                 dns.vvtt2.com. dns                IN      A          10.0.165.253 www                IN      A          10.0.165.253   $TTL 86400 vvtt1.com.   IN     SOA       dns.vvtt1.com.                      root.vvtt1.com ( 20100820                    ;serial 1H                          ;refresh 15M                         ;retry 1W                          ;expire 1D)                         ;minimun   vvtt1.com.   IN     NS                 dns.vvtt1.com. dns                IN      A          10.0.165.253 www                IN      A          10.0.165.253   // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. //   options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory  “/var/named”; dump-file  “/var/named/data/cache_dump.db”; statistics-file “/var/named/data/named_stats.txt”; memstatistics-file “/var/named/data/named_mem_stats.txt”; allow-query     { 0.0.0.0/0; }; recursion yes;   dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto;   /* Path to ISC DLV key */ bindkeys-file “/etc/named.iscdlv.key”;   managed-keys-directory “/var/named/dynamic”; };   logging { channel default_debug { file “data/named.run”; severity dynamic; }; };   zone “gdhy.col” { type master; file “gdhy.col”; };   zone “165.0.10.in-addr.arpa” { type master; file “165.0.10”; };   zone “vvtt1.com” { type master; file “vvtt1.com”; };   zone “vvtt2.com” { type master; file “vvtt2.com”; };   include “/etc/named.rfc1912.zones”; include “/etc/named.root.key”;   httpd.conf: NameVirtualHost 10.0.165.253……

(转)在Redhat安装部署Apache+MySQL+PHP(LAMP)

原文地址:https://my.oschina.net/alanlqc/blog/145449 1. 安装Apache2 yum install httpd Apache安装完成后,手动启动Apache2 /etc/init.d/httpd start 这时,直接在浏览器中输入服务器的IP地址,即可看到Apache2的默认页面。此时的Apache仅仅能提供HTTP服务,不能执行php、也不能连接MySQL数据库。 2. 安装MySQL yum install mysql mysql-server 完成后,使用如下命令启动MySQL服务: /etc/init.d/mysqld start 3. 安装PHP5 yum install php 安装完php5后,必须要重新启动Apache以使php生效: /etc/init.d/httpd restart 这时,Apache已经可以解析执行php脚本了。由于Apache的默认网站根目录位于:/var/www/html/,因此在此目录建立一个info.php用来测试Apache+PHP的正确安装与否: echo “<?php phpinfo(); ?>” > /var/www/html/info.php 然后在浏览器中访问 IP/info.php,出现了PHPINFO的输出信息则表示安装成功 安装php的mysql模块 yum install php-mysql 完成后再次重启Apache /etc/init.d/httpd restart 最后还需要将LAMP组件设置为自动启动: chkconfig –levels 2345 httpd on chkconfig –levels 2345 mysqld on 测试环境(阿里云虚机): 登录本地的MySQL创建一个表,创建一个用户,设定该用户对表的操作权限 use test; create table login( uid char(20), dt int, text char(50) ); grant select,insert,update,delete on *.* to alan@”%” identified by ‘password’; test.php <?php $host = ‘xxx.xxx.xxx.xxx’; $user = ‘alan’; $passwd = ‘password’; $db = ‘test’; $conn = mysql_connect($host,$user,$passwd); if (!$conn) { die(‘Could not connect: ‘ . mysql_error()); } echo “select data from MySQL<br \>”; mysql_select_db($db, $conn); $select_sql = “select * from login”; $result = mysql_query($select_sql); echo “<table border=’1’><tr><th>uid</th><th>time</th><th>text</th></tr>”; while ($row = mysql_fetch_array($result)) { echo “<tr>”; echo “<td>”.$row[‘uid’].”</td>”; echo “<td>”.$row[‘dt’].”</td>”; echo “<td>”.$row[‘text’].”</td>”; echo “</tr>”; } echo “</table><br \>”; echo “<form action=’insert.php’ method=’post’> Name:<input type=’text’ name=’uid’ /> text:<input type=’text’ name=’text’ /> <input type=’submit’></form>”; mysql_close($conn); ?> insert.php <?php $host = ‘xxx.xxx.xxx.xxx’; $user = ‘alan’; $passwd = ‘password’; $db……