Web
服务器称为WWW
服务器,主要是提供上网功能;Web
服务器有:Microsoft IIS
、IBM WebSphere
、Apache
、Tomcat
等;Apache
服务器为例了解一些Linux/centos上
如何配置管理Web服务器。Apache
是一种开源的Web
服务器软件;Unix
、Linux
、BSD
等操作系统;SSL
和虚拟主机;Apache
服务,如下:rpm -qa | grep httpd
yum -y install httpd
httpd
服务的运行状态:systemctl status httpd.service
httpd
服务:systemctl start httpd.service
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2023-11-08 17:53:21 CST; 2s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 5953 (httpd)
Status: "Processing requests..."
Tasks: 9
CGroup: /system.slice/httpd.service
├─5953 /usr/sbin/httpd -DFOREGROUND
├─5954 /usr/libexec/nss_pcache 6 off
├─5956 /usr/sbin/httpd -DFOREGROUND
├─5958 /usr/sbin/httpd -DFOREGROUND
├─5959 /usr/sbin/httpd -DFOREGROUND
├─5960 /usr/sbin/httpd -DFOREGROUND
├─5961 /usr/sbin/httpd -DFOREGROUND
└─5962 /usr/sbin/httpd -DFOREGROUND
Nov 08 17:53:20 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Nov 08 17:53:20 localhost.localdomain httpd[5953]: AH00558: httpd: Could not reliably determine the server's fully qualified domain na...message
Nov 08 17:53:21 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
httpd
服务:systemctl stop httpd.service
httpd
服务:systemctl restart httpd.service
systemctl enable httpd.service
systemctl list-unit-files | grep httpd
Apache
服务的配置文件为httpd.conf
,文件在`/etc/httpd/conf/下:
httpd.conf
文件内容说明:内容 | 说明 |
---|---|
| 全局环境设置 |
| 主服务器设置 |
虚拟主机设置 |
指令 | 说明 | 示例 |
---|---|---|
| 设置 |
|
| 设置 |
|
| 设置 |
|
| 设置 |
|
| 指定 |
|
| 设置 |
|
| 设置特定虚拟主机 |
|
| 设置管理员邮箱 |
|
| 设置接收和发送数据时的超时时间 |
|
| 指定 |
|
| 指定 | / |
| 其他配置文件 | / |
Web
站点;NoamaNelson
,修改权限,并建立目录public_html
:
useradd NoamaNelson
mkdir /home/NoamaNelson/public_html
chmod +711 /home/NoamaNelson/
chmod +755 /home/NoamaNelson/public_html/
public_html
下建立网页文件index,html
:vim /home/NoamaNelson/public_html/index.html
Welcome everyone,
This is my Web~~~
/etc/httpd/conf.d/userdir.conf
文件:<IfModule mod_userdir.c>
#UserDir disabled
UserDir public_html
</IfModule>
<Directory "/home/*/public_html">
AllowOverride FileInfo AuthConfig Limit Indexes
#Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Options None
Require method GET POST OPTIONS
</Directory>
Require method GET POST OPTIONS
Selinux
设置为Permissive
:
systemctl start httpd
systemctl stop firewalld.service
setenforce 0
getenforce
服务ip/ ~NoamaNelson/
即可打开NoamaNelson
的个人主页,比如我的是如下:
http://172.28.18.146/~NoamaNelson/
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。