openSUSE下安装LAMP

本文介绍如何在openSUSE系统中安装Apache2并进行基本配置,包括启动、重启、停止Apache服务,设置开机自启,验证安装是否成功,并开放防火墙HTTP端口以允许远程访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载:https://en.opensuse.org/SDB:LAMP_setup

Installing Apache2

First of all, make sure you have root access and enter the following command:

root # zypper in apache2

Starting Apache2

To start the apache server, enter the following command:

root # systemctl start apache2

If you ever want to restart the apache server, use:

root # systemctl restart apache2

or if you want to stop it

root # systemctl stop apache2

To automatically start the apache server after a reboot:

root # systemctl enable apache2


Testing the installation

To check if you apache server works, use you favorite text editor an create the index.html file in the /srv/www/htdocs/ folder with the following content:

<html><body><h1>Welcome to my web site!</h1></body></html>

Enabling public access to the web server

In this state the web server is only accessible as localhost. If you want to give access to it from a remote host, you have to open port http (=80) in the firewall. To do this, edit the /etc/sysconfig/SuSEfirewall2 file and change the line

FW_CONFIGURATION_EXT=""

into

FW_CONFIGURATION_EXT="apache2""

A space should separate elements in that line

After editing you have to restart the firewall using:

root # systemctl restart SuSEfirewall2

Alternatively, you can do this using YaST and selecting Security and Users --> Firewall --> Allowed services and add HTTP server.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值