Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####################
- Bash
- ####################
- #!/bin/bash
- echo -n "masukin nama webnya : "
- read vhost
- export host=$vhost
- sudo mkdir /var/www/html/$host
- sudo chown -R www-data.www-data /var/www/html/$host
- sudo chmod -R 0755 /var/www/html/$host
- cat >>$host.conf<<eof
- <VirtualHost *:80>
- ServerAdmin admin@$host
- ServerName $host
- ServerAlias www.$host
- DocumentRoot /var/www/html/$host/
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- </VirtualHost>
- eof
- sudo cp $host.conf /etc/apache2/sites-available/$host.conf
- sudo nano /etc/hosts
- sudo a2ensite $host
- sudo service apache2 reload
- ############################################
- Make a virtualhost using cpp
- @41enurhi74z
- contact : https://facebook.com/ale.gautama
- compile this source:
- c++ virtual_host.cpp -o vhost
- <VirtualHost *:80>
- ServerAdmin admin@41enurhi74z.id
- ServerName 41enurhi74z.id
- ServerAlias www.41enurhi74z.id
- DocumentRoot /var/www/41enurhi74z.id/
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- </VirtualHost>
- #############################################################
-
- #include<iostream>
- #include<string>
- #include<stdlib.h>
- using namespace std;
- int main(){
- string nama_web_dir;
- cout<<"Masukan nama direktory web: \n";
- cin>>nama_web_dir;
- string mkdir_web = "sudo mkdir /var/www/"+nama_web_dir;
- system(mkdir_web.c_str());
- string _chown = "sudo chown -R www-data.www-data /var/www/"+nama_web_dir;
- system(_chown.c_str());
- string prmsion;
- cout<<"value for permision folder web:\n";
- cin>>prmsion;
- string _chmod ="sudo chmod -R "+prmsion+" /var/www/"+nama_web_dir;
- system(_chmod.c_str());
- string _conf = "sudo cp _.conf /etc/apache2/sites-available/"+nama_web_dir+".conf";
- system(_conf.c_str());
- string edit_conf = "sudo nano /etc/apache2/sites-available/"+nama_web_dir+".conf";
- system(edit_conf.c_str());
- string _actif = "sudo a2ensite "+nama_web_dir;
- system(_actif.c_str());
- string _index = "sudo cp index.php /var/www/"+nama_web_dir+"/index.php";
- system(_index.c_str());
- system("sudo nano /etc/hosts");
- system("sudo service apache2 reload");
- cout<<"success make a virtual host \ncoded : 41enurhi74z";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement