Rabu, 12 Februari 2014

Mengubah DocumentRoot Pada Apache2 di Ubuntu

"Jika kita terlalu perfeksionis, kita tak akan bisa menghasilkan apa - apa"
Sepertinya kata - kata itu benar juga. Di blog ini ada banyak draft yang belum terselesaikan hanya karena aku merasa kurang sumber, takut salah, dan kurang bagus dalam menyusun kata. Mungkin itu kelemahanku sebagai pribadi.
Karena itu lebih baik menulis acak - acakan, ga ada koherensi antar kalimat, diksi yang buruk, dan topik yang ga jelas daripada ga menulis sama sekali...
:p

Sebagai catatan, postingan ini hanyalah catatan perjuanganku untuk memindah document root pada apache server di ubuntu.

langkah pertama :
install taskel

sudo apt-get install taskel

Langkah 2
Install lamp-server

sudo apt-get install lamp-server^

langkah ketiga
masuk ke /etc/apache2/sites-available/

cd /etc/apache2/sites-available/

langkah ke 4
kopi isi 000-default ke mysite.conf

sudo cp 000-default.conf mysite.conf

langkah ke 5

gksu gedit mysite.conf

pada " DocumentRoot /var/www" ganti dengan  "DocumentRoot /home/s4if/Workspaces/web" (tanpa tanda petik)
kemudian tambahkan baris seperti ini

<Directory /home/s4if/Workspaces/web/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
        allow from all
    </Directory>

langkah ke 6
enable mysite.conf

sudo a2dissite 000-default.conf && sudo a2ensite mysite.conf
langkah ke 7

sudo service apache2 reload

atau kalau perlu restart saja...

hasil confignya seperti ini :
#=====================================
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /home/s4if/Workspaces/web
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
        allow from all
    </Directory>
    <Directory /home/s4if/Workspaces/web/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
        allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#=====================================

Sekian, elek yo ben, sing penting le gawe dhewe...
3:)

nb : oiya kalo ada error coba lakukan langkah2 ini :
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www
dan kalo masih error, cek permision file-nya...

Sumber :
https://help.ubuntu.com/community/ApacheMySQLPHP
http://askubuntu.com/questions/292968/apache2-forbidden-you-dont-have-permission-to-access-dir-on-this-server
dan sumber - sumber lain (baca : googling)

Tidak ada komentar:

Posting Komentar