阿里云服务器window10使用apache设置web服务

132 阅读1分钟

1. 首页在阿里云服务器ECS 》网络与安全 》 安全组 》点击‘配置规则’

2. win+r : mstsc 通过公网IP远程连接服务器

3. 安装 apache (略……)

4. 配置文件

apache安装目录下,打开httpd.conf

...\Apache24\conf\httpd.conf

如下配置:

# 服务监听的端口号,默认80

Listen 80 

 # 网站2监听的端口,配置好后可通过公网IP xx.xx.xx.xx:8080 访问

# 需要在安全规则内配置号8080端口

Listen 8080

<VirtualHost *:80>

  DocumentRoot "C:/www/home" # 网站存放路径

  ServerName localhost # 网站服务名称,对应 C:\Windows\System32\drivers\etc\hosts

<VirtualHost *:8080>

  DocumentRoot "C:/www/dist"

  ServerName localhost

  <Directory "C:/www/dist">

    AllowOverride None

    Options None

    Require all granted

 

 修改 C:\Windows\System32\drivers\etc\hosts (拖到桌面修改)

# localhost对应上面的ServerName

127.0.0.1 localhost 

5. 重启apache服务

配置完成!