0
点赞
收藏
分享

微信扫一扫

apache设置开机自启但是开机端口80没开

何以至千里 2021-09-22 阅读 61
日记本

开机后查看端口

[root@qiangqiang ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2249/sshd           
tcp        0      0 0.0.0.0:59163               0.0.0.0:*                   LISTEN      1596/rpc.statd      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2358/mysqld         
tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      2072/memcached      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1486/rpcbind        
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1891/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1646/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1977/master         
tcp        0      0 ::1:6010                    :::*                        LISTEN      2249/sshd           
tcp        0      0 :::52071                    :::*                        LISTEN      1596/rpc.statd      
tcp        0      0 :::11211                    :::*                        LISTEN      2072/memcached      
tcp        0      0 :::111                      :::*                        LISTEN      1486/rpcbind        
tcp        0      0 :::22                       :::*                        LISTEN      1891/sshd           
tcp        0      0 ::1:631                     :::*                        LISTEN      1646/cupsd          
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               1643/dhclient       
udp        0      0 0.0.0.0:11211               0.0.0.0:*                               2072/memcached      
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1486/rpcbind        
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1646/cupsd          
udp        0      0 0.0.0.0:48266               0.0.0.0:*                               1596/rpc.statd      
udp        0      0 127.0.0.1:924               0.0.0.0:*                               1596/rpc.statd      
udp        0      0 0.0.0.0:813                 0.0.0.0:*                               1486/rpcbind        
udp        0      0 :::11211                    :::*                                    2072/memcached      
udp        0      0 :::55258                    :::*                                    1596/rpc.statd      
udp        0      0 :::111                      :::*                                    1486/rpcbind        
udp        0      0 :::813                      :::*                                    1486/rpcbind        

发现端口没开,检测语法是否错误

[root@qiangqiang ~]# vim /usr/local/apache2/etc/httpd.conf
[root@qiangqiang ~]# apachectl -t
Syntax OK

用开机自启方式打开apache,发现错误

[root@qiangqiang ~]# /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 503 of /usr/local/apache2/etc/httpd.conf: </IfModule> without matching <IfModule> section

错误是缺少模块头<IfModule>

从配置文件备份版找到模块头填入

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

重启开机后,端口打开

[root@qiangqiang ~]# reboot

Broadcast message from root@qiangqiang
    (/dev/pts/0) at 7:17 ...

The system is going down for reboot NOW!
[root@qiangqiang ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2592/sshd           
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2357/mysqld         
tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      2073/memcached      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1486/rpcbind        
tcp        0      0 0.0.0.0:48723               0.0.0.0:*                   LISTEN      1596/rpc.statd      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1891/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1646/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1977/master         
tcp        0      0 ::1:6010                    :::*                        LISTEN      2592/sshd           
tcp        0      0 :::44422                    :::*                        LISTEN      1596/rpc.statd      
tcp        0      0 :::11211                    :::*                        LISTEN      2073/memcached      
tcp        0      0 :::111                      :::*                        LISTEN      1486/rpcbind        
tcp        0      0 :::80                       :::*                        LISTEN      2360/httpd          
tcp        0      0 :::22                       :::*                        LISTEN      1891/sshd           
tcp        0      0 ::1:631                     :::*                        LISTEN      1646/cupsd          

成功成功

举报

相关推荐

0 条评论