Mapserver

Pembuatan Alias HTTP Pada Mapserver Ms4w

Alias HTTP pada MapServer MS4W memungkinkan Anda mengakses project web GIS dengan URL yang lebih pendek dan mudah diingat. Tutorial ini membahas cara membuat dan mengkonfigurasi alias pada server MS4W.

Apa itu Alias HTTP?

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, Anda bisa membuat alias sehingga cukup mengakses http://localhost/myproject/.

Apa itu MS4W?

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.

Step 1: Lokasi Konfigurasi Apache

File konfigurasi Apache di MS4W berada di C:/ms4w/Apache/conf/httpd.conf. Buka file ini dengan text editor (Notepad++ atau VS Code).

Step 2: Tambah Alias

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>

Step 3: Konfigurasi CGI

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>

Step 4: Buat Mapfile

Buat file .map di direktori project Anda. 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

Step 5: Restart Apache

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

Step 6: Test Alias

Buka browser dan akses alias yang sudah dibuat:

  • http://localhost/myproject/ - untuk mengakses web GIS
  • http://localhost/myproject/cgi-bin/mapserv.exe?map=C:/ms4w/apps/myproject/mapfile.map - untuk mengakses MapServer CGI

Troubleshooting

  • 403 Forbidden: Cek permission direktori dan konfigurasi Require
  • 404 Not Found: Pastikan path direktori benar
  • 500 Internal Server Error: Cek error log Apache di C:/ms4w/Apache/logs/
  • MapServer error: Pastikan path mapfile benar dan shapefile ada

Tips Keamanan

  • Jangan expose direktori system di alias
  • Gunakan .htaccess untuk membatasi akses
  • Disable directory listing jika tidak diperlukan
  • Gunakan HTTPS untuk produksi

Kesimpulan

Membuat alias HTTP pada MS4W mempermudah akses project web GIS dan membuat URL lebih profesional. Dengan konfigurasi yang benar, project GIS Anda bisa diakses dengan URL yang singkat dan mudah diingat.


You may also like


1 Comments

paper writer services13 Feb 2021

Howdy would you mind letting me know which webhhost you're working with? I've loaded your blog in 3 different browsers aand I must sayy this blog loads a loot quicker then most. Can you suggest a good hosting provider at a honest price? Thanks, I appreciate it! https://750-word-essa8212.hpage.com/purchase-research-papers-online.html paper writer services paper writer services https://works.bepress.com/arthistoryiresearchpapertopics/14/

Reply

Leave a Reply

Scroll to Top