dnf -y install httpd
Listen 127.0.0.1:80
DocumentRoot "/var/www/html"
DocumentRoot "/var/mywebsite/html"
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@testvm1 ~]# cd /etc/sysconfig/ ; iptables-restore iptables
[root@testvm1 html]# chown apache.apache index.html
[root@testvm1 ~]# systemctl start httpd
[root@testvm1 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2018-02-08 13:18:54 EST; 5s ago
Docs: man:httpd.service(8)
Main PID: 27107 (httpd)
Status: "Processing requests..."
Tasks: 213 (limit: 4915)
CGroup: /system.slice/httpd.service
├─27107 /usr/sbin/httpd -DFOREGROUND
├─27108 /usr/sbin/httpd -DFOREGROUND
├─27109 /usr/sbin/httpd -DFOREGROUND
├─27110 /usr/sbin/httpd -DFOREGROUND
└─27111 /usr/sbin/httpd -DFOREGROUND
Feb 08 13:18:54 testvm1 systemd[1]: Starting The Apache HTTP Server...
Feb 08 13:18:54 testvm1 systemd[1]: Started The Apache HTTP Server.
[root@testvm1 ~]# service httpd start
Starting httpd: [Fri Feb 09 08:18:07 2018] [ OK ]
[root@testvm1 ~]# service httpd status
httpd (pid 14649) is running...
[root@testvm1 ~]# dnf -y install lynx
[root@testvm1 ~]# lynx localhost
Hello World
Commands: Use arrow keys to move, '?' for help, 'q' to quit, '<-' to go back.
Arrow keys: Up and Down to move. Right to follow a link; Left to go back.
H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list```
Hello World
Commands: Use arrow keys to move, '?' for help, 'q' to quit, '<-' to go back.
Arrow keys: Up and Down to move. Right to follow a link; Left to go back.
H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list
相关资讯