ubantu16.04
更新
sudo apt-get update
安装
sudo apt-get install apache2
index.html
cd /var/www/html
vi index.html
curl http://127.0.0.1/
可以访问 index.html
配置Apache环境
cd /etc/apache2
vi apache2.conf
修改apache2.conf
省略部分代码
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
NameVirtualHost 47.**.***.***
<VirtualHost 47.**.**.***>
ServerName www.***.com
<VirtualHost>
curl http://127.0.0.1/
可以本地访问
curl http://公网IP/
可以公网访问
此处需要注意
阿里云apache服务器外网无法访问(配置安全组,添加80服务)
阿里云云服务器控制台 ,在安全组,安全组规则或者配置规则,添加安全组规则,进行设置。
参考:https://www.cnblogs.com/ScratchingBear/p/5397940.html
https://blog.csdn.net/qq_33813365/article/details/76633751