Ubuntu21.04 安装mapserver教程(宝塔面板中安装mapserver)

前言

之前安装部署mapserver绕了很多弯路,没有找到合适的教程,官方给出的是全新系统安装。
而我们大多数折腾的小伙伴可能很我一样是在已有的环境安装,特别是像我这样在宝塔面板里安装

一、更新apt

apt update && apt upgrade

二、安装Lamp环境(apache + mysql + php)(已经安装了环境的跳过

0、如果使用的是Nginx环境请参考另一篇教程

查看这里:ubuntu中使用Nginx配置Mapserver

1、这里直接用宝塔一键安装

(1)直接在终端输入一下命令(一步到位)

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh

(2)安装完成记录信息

> ================================================================== 
> 外网面板地址: http://[240e:34c:2616:1320:21c:42ff:feb4:6d3c]:8888/75e3d282
> 内网面板地址: http://192.168.28.40:8888/75e3d282 
> username: eyp6vaug
> password: e6f7a475 
> If you cannot access the panel, release the
> following panel port [8888] in the security group
> 若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
> =================================================================

(3)登陆面板 > 修改面板配置信息

同一局域网下用浏览器打开刚才显示的内网面板地址:

http://192.168.28.40:8888/75e3d282

输入默认生成的账户密码

username: eyp6vaug
password: e6f7a475
在这里插入图片描述

登陆宝塔账号

在这里插入图片描述

选择需要安装的环境(记得要选apache环境)

在这里插入图片描述

选择右侧栏》》》面板设置

在这里插入图片描述

修改配置

a.修改 安全入口
b.修改 面板用户(面板登陆用户名)
c.修改 面板密码(面板登陆密码)
在这里插入图片描述

三、安装配置 mapserver

1、安装mapserver

终端输入:

sudo apt-get install mapserver-bin mapserver-doc

注:因为 UbuntuGIS库的存在,这里安装时相关库会自动安装。

安装结果

$ sudo apt-get install mapserver-bin mapserver-doc

[sudo] password for *******: Reading package lists… Done Building
………………………………

2、部署(此处划重点)

方法一:

1、 建立软连接到apache下cgi-bin目录

cd /www/server/apache/cgi-bin/
sudo ln -s /usr/bin/mapserv mapserv

2.修改apache配置文件

配置文件位置:
/www/server/apache/conf/httpd.conf
在这里插入图片描述
如果在宝塔面板中直接双击打开httpd.conf文件
windows下为:ctl+F组合快捷键
Mac下为: command+F
搜索如下:

#LoadModule cgid_module modules/mod_cgid.so

修改为(去掉#):

LoadModule cgid_module modules/mod_cgid.so

搜索如下内容:

<Directory "/www/server/apache/cgi-bin">
    AllowOverride All
    Options None
    Require all granted
</Directory>

修改为:
重点:
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

<Directory "/www/server/apache/cgi-bin">
    AllowOverride All
    # Options None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>

方法二

2.修改apache配置文件

配置文件位置:
/www/server/apache/conf/httpd.conf

如果在宝塔面板中直接双击打开httpd.conf文件
windows下为:ctl+F组合快捷键
Mac下为: command+F
搜索如下:

#LoadModule cgid_module modules/mod_cgid.so

修改为(去掉#):

LoadModule cgid_module modules/mod_cgid.so

搜索如下内容:

<Directory "/www/server/apache/cgi-bin">
    AllowOverride All
    Options None
    Require all granted
</Directory>

修改为:
重点:
<Directory “/usr/lib/cgi-bin”>
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    # Options None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Require all granted
</Directory>

最终结果

怎么看mapserver是否配置成功

在局域网下的浏览器中打开如下链接:
http://替换自己 IP /cgi-bin/mapserv?

如果返回结果为如下:

No query information to decode. QUERY_STRING is set, but empty.

在这里插入图片描述
说明你的mapserver配置成功。大功告成!!!!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值