Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

This is a simple script to setup a vdir and folder for Apache on Ubuntu:

 

First make a template file for the Apache config

First:

nano /etc/apache2/sites-available/template.conf

<VirtualHost *:80>

    ServerAdmin your@email.addy

    ServerName newsite

    ServerAlias newsite

    DocumentRoot /var/www/newsite/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

#save the above

 

 

Second:

nano createweb.sh

 echo "Setting up website: $1"

 sitename=$1

 sudo mkdir /var/www/$1

 sudo mkdir /var/www/$1/public_html

 sudo chown -R ubuntu:ubuntu /var/www/$1/public_html

 sudo cp /etc/apache2/sites-available/template.conf /etc/apache2/sites-available/$1.conf

 sed -i "s/newsite/$sitename/g" /etc/apache2/sites-available/$sitename.conf

 sudo a2ensite $sitename.conf

 sudo chown -R www-data:www-data /var/www

 sudo service apache2 restart

 

 

Third:

Now give accesss to run

chmod +x createweb.sh

 

Fourth:

Now test it:

./createweb.sh mylamesite.com

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

 

If you need to give access for the web server to use office automation the easiest way is to just open dcom.

 

1. In DCOMCNFG, right click on the My Computer and select properties. 
2. Choose the COM Securities tab
3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for <Machine_name>\Users.
4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for <Machine_name>\Users

You may need to add IUSR and IIS_USRS depending on your configuration

 

Also, you have to install office on the web server for this to even work at all.

Installing just o2010pia will do nothing for you.

 

If you are creating office documents within a IIS website user file permissions is going to be crucial.

I recommend creating a local user account on the web server and running your application pool under that user.

You will also want to login as that user on the web server and open the office application you plan to automate. You might get the "enter your initial" box when first opening the application and this is what is happening during automation of an office document so it errors. 

You get things like 

  Exception message: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution