失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > ubuntu之搭建http服务器apache2

ubuntu之搭建http服务器apache2

时间:2022-12-20 08:28:52

相关推荐

ubuntu之搭建http服务器apache2

1.安装

sudo apt-get updatesudo apt-get install apache2

2.配置

2.1修改端口1

命令修改端口为8888:

sudo gedit /etc/apache2/ports.conf

修改如下:

2.2修改端口2

sudo gedit /etc/apache2/sites-available/000-default.conf

2.3在/var/www/html添加需要保存的目录

其中4.5.2为opencv的html文件

2.4 重启服务器

sudo systemctl restart apache2

2.5 访问服务器

http://192.168.0.77:8888/4.5.2/

3.管理Apache进程

现在您已经启动并运行了Web服务器,让我们回顾一些基本的管理命令。

要停止您的Web服务器,请键入:

sudo systemctl stop apache2

停止时要启动Web服务器,请输入:

sudo systemctl start apache2

要停止并再次启动服务,请键入:

sudo systemctl restart apache2

如果您只是简单地进行配置更改,Apache通常可以重新加载而不会丢失连接。为此,请使用以下命令:

sudo systemctl reload apache2

默认情况下,Apache被配置为在服务器引导时自动启动。如果这不是您想要的,请键入以下命令禁用此行为:

sudo systemctl disable apache2

要重新启用该服务以在启动时启动,请键入:

sudo systemctl enable apache2

Apache现在应该在服务器再次启动时自动启动。

如果觉得《ubuntu之搭建http服务器apache2》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。