Alias HTTP pada MapServer MS4W memungkinkan kamu mengakses project web GIS dengan URL yang lebih pendek dan mudah diingat. Tutorial ini membahas cara membuat dan mengkonfigurasi alias pada server MS4W.
Alias HTTP adalah mapping antara URL pendek dengan lokasi sebenarnya di server. Misalnya, alih-alih mengakses http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/myproject/mapfile.map, kamu bisa membuat alias sehingga cukup mengakses http://localhost/myproject/.
MS4W (MapServer for Windows) adalah paket installer yang berisi MapServer dan komponen pendukungnya untuk platform Windows. MS4W sudah include Apache web server, PHP, dan berbagai library GIS.
File konfigurasi Apache di MS4W berada di C:/ms4w/Apache/conf/httpd.conf. Buka file ini dengan text editor (Notepad++ atau VS Code).
Tambahkan konfigurasi berikut di httpd.conf:
# Alias untuk project GIS Alias /myproject "C:/ms4w/apps/myproject" <Directory "C:/ms4w/apps/myproject"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> Untuk menjalankan MapServer CGI, tambahkan ScriptAlias:
# ScriptAlias untuk MapServer CGI ScriptAlias /cgi-bin/ "C:/ms4w/Apache/cgi-bin/" # Alias untuk mapserv di project tertentu Alias /myproject/cgi-bin "C:/ms4w/Apache/cgi-bin" <Directory "C:/ms4w/Apache/cgi-bin"> Options ExecCGI Require all granted </Directory> Buat file .map di direktori project kamu. Pastikan path di mapfile menggunakan format MS4W:
MAP NAME "myproject" STATUS ON SIZE 800 600 WEB IMAGEPATH "C:/ms4w/apps/myproject/tmp/" IMAGEURL "/myproject/tmp/" END LAYER NAME "base" TYPE POLYGON STATUS ON DATA "shapefile/nama_shapefile" END END Restart Apache MS4W agar konfigurasi baru diterapkan:
# Via Command Prompt (Run as Administrator) cd C:/ms4w Apacheinhttpd.exe -k restart # Atau restart layanan Apache jika sudah diinstall sebagai service net stop ApacheMS4W net start ApacheMS4W Buka browser dan akses alias yang sudah dibuat:
Membuat alias HTTP pada MS4W mempermudah akses project web GIS dan membuat URL lebih profesional. Dengan konfigurasi yang benar, project GIS kamu bisa diakses dengan URL yang singkat dan mudah diingat.
Alias HTTP pada MapServer memungkinkan kamu membuat shortcut URL untuk mengakses data spasial. Ini berguna untuk:
Edit file httpd.conf Apache untuk menambahkan alias:
# Konfigurasi alias di Apache
Alias /gis/data "C:/ms4w/apps/data"
<Directory "C:/ms4w/apps/data">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Sebelum alias
http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/project/mapfile.map&...
# Setelah alias
http://localhost/gis/data/mapfile.map?...