ERROR 403 after create site using sites_web_domain_add

Discussion in 'Developers' Forum' started by chuvantai, Nov 1, 2010.

  1. chuvantai

    chuvantai New Member

    Hello
    i've read this topic to automate create users and website using remoting framework.
    here is my code
    PHP:
    // Add client
                    
    $params_client = array(        'server_id' => 1,
                                            
    'company_name' => $company,
                                            
    'contact_name' => $fullname,
                                            
    'customer_no' => '111',
                                            
    'username' =>$username,
                                            
    'password' =>$password,
                                            
    'language' =>'en',
                                            
    'usertheme' =>'default',
                                            
    'street' =>$street,
                                            
    'zip' =>'',
                                            
    'city' =>'',
                                            
    'state' =>'non-US',
                                            
    'country' =>'VN',
                                            
    'telephone' =>$telephone,
                                            
    'mobile' =>'',
                                            
    'fax' =>'',
                                            
    'email' =>$email,
                                            
    'internet' =>'',
                                            
    'icq' =>'',
                                            
    'vat_id' =>'',
                                            
    'notes' =>'',  
                                            
    'template_master' => '0',
                                            
    'template_additional' =>'',
                                            
    'default_mailserver' =>'1',
                                            
    'limit_maildomain' =>'1',
                                            
    'limit_mailbox' =>'10',
                                            
    'limit_mailalias' =>'10',
                                            
    'limit_mailaliasdomain' =>'10',
                                            
    'limit_mailforward' =>'10',
                                            
    'limit_mailcatchall' =>'10',
                                            
    'limit_mailrouting' => '10',
                                            
    'limit_mailfilter' =>'10',
                                            
    'limit_fetchmail' =>'10',
                                            
    'limit_mailquota' =>'10',
                                            
    'limit_spamfilter_wblist' =>'-1',
                                            
    'limit_spamfilter_user' =>'-1',
                                            
    'limit_spamfilter_policy' =>'-1',
                                            
    'default_webserver' =>'1',
                                            
    'limit_web_quota' =>'100',
                                            
    'limit_web_domain' =>'10',
                                            
    'web_php_options' =>"suphp",
                                            
    'limit_web_aliasdomain' =>'-1',
                                            
    'limit_web_subdomain' =>'-1',
                                            
    'limit_ftp_user' =>'-1',
                                            
    'limit_shell_user' =>'-1',
                                            
    'ssh_chroot' =>'no',
                                            
    'limit_webdav_user' =>'1',
                                            
    'default_dnsserver' =>'1',
                                            
    'limit_dns_zone' =>'-1',
                                            
    'limit_dns_slave_zone' =>'-1',
                                            
    'limit_dns_record' =>'-1',
                                            
    //'limit_client' =>'0',
                                            
    'default_dbserver' =>'1',
                                            
    'limit_database' =>'-1',
                                            
    'limit_cron' =>'0',
                                            
    'limit_cron_type' =>'',
                                            
    'limit_traffic_quota' =>'-1',
                                            
    'limit_cron_frequency' =>'-1');
                    
                    
    $client_id $client->client_add($session_id$reseller_id$params_client);
                    
                    
                    
    // Add website
                    //$client_id=$domain_id;
                    
    mysql_select_db($dbispconfig) or die("Cannot select database");
                    
                    
    $tablename         "web_domain";
                    
    $next_increment     0;
                    
    $qShowStatus         "SHOW TABLE STATUS LIKE '$tablename'";
                    
    $qShowStatusResult     mysql_query($qShowStatus) or die ( "Query failed: " mysql_error() . "<br/>" $qShowStatus );
                    
    $row mysql_fetch_assoc($qShowStatusResult);
                    
    $next_increment $row['Auto_increment'];

                    
    $domain_id $next_increment;
                    
                    
    //Now we need to generate doc root and apache basedir etc. as well... Nothing works without them
                    //Document root
                    
    $document_root "/var/www/clients/client".$client_id."/web".$domain_id;
                    
    //system user
                    
    $system_user "web".$domain_id;
                    
    //system group
                    
    $system_group 'client'.$client_id;
                    
    //This stuff comes from config usually in ISPCP - We don't want to do a hard include to their config so rather we generate it here
                    
    $php_open_basedir="/var/www/clients/client".$client_id."/web".$domain_id."/web:/var/www/clients/client".$client_id."/web".$domain_id."/tmp:/var/www/".$domain."/web:/srv/www/".$domain."/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin";
                    
    //Do the update  
                                //     /var/www/clients/client0/web13/web:/var/www/clients/client0/web13/tmp:/var/www/xxx.xx/web:/srv/www/xxx.xx/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
                        
                    
    $params_website = array('server_id' => 1,
                                            
    'ip_address' => '*',
                                            
    'domain' => $domain,
                                            
    'type' => 'vhost',
                                            
    'parent_domain_id' => '',
                                            
    'vhost_type' => 'name',
                                            
    'hd_quota' => '50',
                                            
    'traffic_quota' => '1000',
                                            
    'cgi' =>'n',
                                            
    'ssi' =>'n',
                                            
    'suexec' =>'n',
                                            
    'errordocs' =>'1',
                                            
    'subdomain' =>'www',
                                            
    'ssl' =>'n',
                                            
                                            
    'php' =>"mod",
                                            
    'ruby' =>'n',
                                            
    'active' =>'y',
                                            
                                            
    'redirect_type' =>'no',
                                            
    'redirect_path' =>'',
                                            
                                            
    'ssl_state' =>'',
                                            
    'ssl_organisation' =>'',
                                            
    'ssl_organisation_unit' =>'',
                                            
    'ssl_country' =>'',
                                            
    'ssl_domain' =>$domain,
                                            
    'ssl_request' =>'',
                                            
    'ssl_cert' =>'',
                                            
    'ssl_bundle' =>'',
                                            
    'ssl_action' =>'',
                                            
                                            
                                            
    //'stats_password' =>$password,
                                            
    'stats_password' =>'',
                                            
    'stats_type' =>'webalizer',
                                            
                                            
    'backup_interval' =>'monthly',
                                            
    'backup_copies' =>'1',
                                            
                                            
    'document_root' =>$document_root,
                                            
    'system_user' =>$system_user,
                                            
    'system_group' =>$system_group,
                                            
    'allow_override' =>'All',
                                            
    'php_open_basedir' =>$php_open_basedir,
                                            
    'custom_php_ini' =>''
                                            
    'apache_directives' =>'',
                                            
    'client_group_id' =>$client_id+1
                                            
    );
                    
                    
    $website_id $client->sites_web_domain_add($session_id$client_id$params_website);
    everything seems fine.

    but when I browse to my client site, server responds 403 error page
    Error log:
    Code:
    root@hostth5c:/var/www/hovanten3.com/log# less error.log 
    [Mon Nov 01 12:20:16 2010] [error] [client 192.168.40.1] client denied by server configuration: /
    [Mon Nov 01 12:35:18 2010] [error] [client 192.168.40.1] client denied by server configuration: /
    
    Virtual Host Configuration
    Thanks and sorry for my bad english :D
     
  2. chuvantai

    chuvantai New Member

    Somebody help me please :((
     

Share This Page