This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/php5/bin/php | |
<?php | |
$domain = null; | |
if (array_key_exists('1', $argv)) { | |
$domain = $argv['1']; | |
$path = str_replace("\n","",`pwd` ); | |
$temlate = <<<TEMPLATE | |
<VirtualHost *:80> | |
ServerName $domain | |
DocumentRoot "$path/" | |
CustomLog /var/log/apache2/{$domain}-access common | |
ErrorLog /var/log/apache2/{$domain}-error | |
</VirtualHost> | |
<VirtualHost *:443> | |
ServerName $domain | |
DocumentRoot "$path/" | |
SSLEngine on | |
SSLProtocol ALL -SSLv2 -SSLv3 | |
SSLHonorCipherOrder On | |
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RS$ | |
SSLCertificateFile /Users/vitaliy/work/projects/appshed-ssl/current/appshed.crt | |
SSLCertificateKeyFile /Users/vitaliy/work/projects/appshed-ssl/current/appshed.key | |
SSLCertificateChainFile /Users/vitaliy/work/projects/appshed-ssl/current/chain.pem | |
CustomLog /var/log/apache2/{$domain}-ssl-access common | |
ErrorLog /var/log/apache2/{$domain}-ssl-error | |
</VirtualHost> | |
TEMPLATE; | |
file_put_contents('/private/etc/apache2/other/'.$domain.'.conf', $temlate); | |
`apachectl restart`; | |
$currentDomains = file_get_contents("/etc/hosts"); | |
if(strpos($currentDomains,$domain) === false){ | |
file_put_contents("/etc/hosts", "127.0.0.1\t$domain \t #$path \n", FILE_APPEND); | |
} | |
}else{ | |
echo "no domain name".PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment