Skip to content

aditbaco/centos7-a2ensite-id_ID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cara install

  1. Login sebagai root atau sudo
  2. Beralih ke direktori usr>local>bin dengan perintah :
cd /usr/local/bin

lalu clone git ini dengan perintah :

git clone https://github.com/aditbaco/centos7-a2ensite-id_ID.git
  1. copas file a2ensite dan a2dissite pada folder centos7-a2ensite-id_ID ke direktori /usr/local/bin Anda
cp centos7-a2ensite-id_ID/centos7-a2ensite ./a2ensssite && cp centos7-a2ensite-id_ID/centos7-a2dissite ./a2dissite

kemudian berikan hak akses file dengan perintah :

chmod +x /usr/local/bin/a2*
  1. Selanjutnya, buat direktori baru untuk menampung konfigurasi apache webserver kita :
mkdir /etc/httpd/sites-available && mkdir /etc/httpd/sites-enabled
  1. Buka configurasi default apache dengan perintah :
nano /etc/httpd/conf/httpd.conf

Lalu tambahkan baris kode berikut ini di bagian paling akhir:

Include sites-enabled/*.conf
  1. Restart apache :
systemctl restart httpd

cara menambah vhost webserver

  1. Tambahkan file konfigurasi apache baru berakhiran .conf di direktori /etc/httpd/sites-available. Contoh:
nano /etc/httpd/sites-available/example.com.conf
  1. Isikan dengan konfigurasi vhost, bisa pakai standar vhost berikut ini, jangan lupa sesuaikan isiannya. Contoh:
# Laravel optimized conf example
<VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com
        Redirect permanent / https://example.com/
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName example.com
        ServerAlias www.example.com
        SSLEngine On
        DocumentRoot /var/www/example.com/public

        <Directory "/var/www/example.com/public">
                AllowOverride All
                Options FollowSymLinks Multiviews indexes
                RewriteEngine On
                Require all granted
                RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
                RewriteRule .* - [F]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        </Directory>

        ErrorLog /etc/httpd/logs/example.com-error.log
        CustomLog /etc/httpd/logs/example.com-access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
</VirtualHost>
</IfModule>

atau gunakan contoh example.com.conf terlampir dengan perintah :

cp /usr/local/bin/centos7-a2ensite-id_ID/example.com.conf /etc/httpd/sites-available/example.com.conf
  1. Terakhir, buat symlink dengan perintah :
a2ensite example.com

untuk mematikan website/virtual host tinggal ketikkan perintah :

a2dissite example.com
  1. Jangan lupa Restart apache :
systemctl restart httpd
  1. Done. Test URL website baru anda.

Supported by : Kaisarpropertindo : https://www.kaisarpropertindo.id Ngenull : https://ngenull.com Dekate : https://dekate.id Frilens : https://frilens.id FNGTMart : https://fngtmart.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages