Scenario
A Joomla website hosted in Linux server is migrated to Windows. Several compatibility issues will be reported. The rules in .htaccess file will not work in Windows Servers which will cause malfunctioning of the website. Here are the steps on how to deal with these issues.
For this to work in IIS, a web.config file should be created and the corresponding rules in .htaccess should be imported to the same file. Here is a sample web.config file. Copy the entire content.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Security Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
</conditions>
<action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="SEO Rule">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
<add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
<add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
So, the file web.config is ready. Now the rules in .htaccess has to be converted in accordance with IIS. In IIS6, you can make use of the ISAPI_REWRITE module. Go to http://www.isapirewrite.com/ for downloading it.
If you are having IIS7, here are the steps involved in converting those rules.
The x86 version of URL Rewrite module can be downloaded here : http://go.microsoft.com/?linkid=9722533
The x64 version of URL Rewrite module can be downloaded here : http://go.microsoft.com/?linkid=9722532
Install the module, restart the IIS manager. Choose the website in which you have to convert the rules (under Sites category). You will see the ‘URL Rewrite’ module in IIS.
Open it. Since the web.config file is already created with some predefined rules, you will see it as Inbound rules (by the Names – Security Rule and SEO Rule).
You can convert the rules in .htaccess file by accessing the ‘Import Rules’ under Inbound Rules category in the Actions pane.
Choose the .htaccess file and click Import. You will see the rules in ‘Rewrite Rules’ section and the converted rules in ‘Converted Rules’ option. Click Apply on the Actions pane on the right hand side to save these rules to the web.config file (If a web.config file was not created as mentioned earlier, that file will be newly created). Make sure there are no conflicts in the conversion. Watch the Summary on the bottom end. There was a conflict when we did it, its shown here. In such cases, remove any unsupported rules and then click Apply.
Converting PHP to FastCGI
We have do it from Plesk control panel. If you don’t have the administrator access, you may need to contact your Administrator. Others (Gods !) read on
Select the Domain, go to Web Hosting Settings.
Scroll down to Services. Choose PHP support to run as FastCGI application.
Final Steps
Go to Joomla Administrator interface. Access Global Configuration from the main menu. Under SEO Settings, make sure the following are set to Yes
Search Engine Friendly URLs : Yes
Use Apache mod_rewrite : Yes
Done, From now your Joomla website shoule work as smooth as it were in the Linux server. Sit back and Enjoy !
Continue ReadingError when trying to logout would be as below and won’t let you logout as well.
“This request cannot be completed because the link you followed or the form you submitted was only valid for minutes. Please try again now.”
Solution
Edit C:\inetpub\vhosts\webmail\horde\lib\horde.php (Drive Letter will depend on where you installed Webmail/Plesk and configured IIS to load virtual hosts from)
And search for section ” SESSION['horde_form_secrets' " in the Horde.php and instead of
if ($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime'] * 60 < time()) {
return PEAR::raiseError(sprintf(_(“This request cannot be completed because the link you followed or the form you submitted was only valid for %s minutes”), $GLOBALS['conf']['urls']['token_lifetime']));
}
it should be
if (($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime']) * 60 < time()) {
return PEAR::raiseError(sprintf(_(“This request cannot be completed because the link you followed or the form you submitted was only valid for %s minutes”), $GLOBALS['conf']['urls']['token_lifetime']));
}
Note the extra braces in red + bold
Continue ReadingCould be a bug with Plesk 9.5 version. But Plesk 9.5 is giving issues once in a while in deleting the domains which are “partially” created.
ISSUE
DNS zones are never created, and the DBs are not properly updated. Even after reconfiguring the domains using websrvmng.exe –reconfigure-vhost –vhost-name =”domain.com” it couldn’t be deleted. Shows the message “Information: Domains are now removed”, but in real, the domain will be still shown under the domains list.
And the domain will be in suspended state. Unsuspension of the domain will result in an error message “DNSZone::Table::select() failed: no such row in the table”
Solution for the above issue is explained at http://www.supportsages.com/blog/2009/08/plesk-account-unsuspension-tableselect-failed-no-such-row-in-the-table/
However even after fixing the DNS like this, the issue cycles.
Removal of domain results in suspension of domain -> Unsuspension of domains results in above error -> Fixing the error allows to unsuspend and Removal of domain results in suspension of domain
SOLUTION
So solution I used to solve was to manually remove the domain related entries from plesk database, from the file system and also from the email services. Get into MySQL or whichever DB plesk is using. For finding the current DB, use Plesk Reconfigurator and then follow the parallels KB found at http://kb.parallels.com/en/3472
The instructions below assumes that you are using Mailenable and Plesk vhosts directory is at “C:\Inetpub\Vhosts” . This location can be at D:\ or E:\ even. Also, I hereby assume that there are no two domains which can match the mysql LIKE query I used below i.e There are no domains like 1domain.com , 2domain.com along with actual domain.com. If there is one, please use your “brain” to find the right domain and the IDs associated with it. When in doubt, please comment.
Disclaimer : If you mess up the database neither me or SS will be responsible for it
Let’s first gather all the ‘id”s first, like dom_id, sys_user_id, id etc which will be helpful in the deletion of database entries relating to the domain name which you want to removed.
1. Getting the IDs.
Domain ID – dom_id or id
mysql> SELECT id FROM domains where name=’domain.com’
We are assuming that dom_id you got as a result of above command is 8880
Database ID – db_id
mysql> select id FROM data_bases where dom_id=(SELECT id FROM domains where name=’domain.com’);
We are assuming that db_id you got as a result of above query is 1433. Please note that you could get more than one result. Please save all the db_id and re-execute the sql query for each db_id.
System User ID – sys_user_id
mysql> select id FROM sys_users where home like '%domain.com%';
We are assuming that sys_user_id you got as a result of above command is 8843
Let’s start the actual deletion process
Shall we backup ? Better be safe!
C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL\bin>mysqldump -P8306 -uadmin -p<plesk DB admin pass> psa > c:\psa.sql
You are now ready to delete. Please execute the follow sql commands in mysql prompt
delete from db_users where db_id='1433'; delete from data_bases where dom_id='8880'; delete from mail where id='8880'; delete from subdomains where id='8880'; delete from dns_recs where id='8880'; delete from domains where id='8880'; delete from domain_aliases where dom_id='8880'; delete from hosting where sys_user_id='8843'; delete FROM sys_users where id='8843'; delete from dns_zone where displayName=’domain.com’;
Database entries are deleted. Now it’s time to remove the users and files from the filesystems, IIS, Server, Mail server, DNS server etc.
Finally,
cd %plesk_bin% domain.exe -r domain.com
These steps should help remove the domain manually from the plesk. Please note that this article is based on the second attempt and could be buggy. I assume some “common sense” when running these commands. Understand the commands and each step before you actually execute it. Good luck. Don’t MESS up!!
Continue ReadingWindows 32 bit edition
You can edit default server backup repository directory path through registry. Go to
Regedit and then browse the keys
HKEY_LOCAL_MACHINE\SOFTWARE\PLESK\PSA Config\Config
Right Click on variable “DUMP_D” select Modify and set the server backup repository path as you wish. Default Directory Path for Plesk Backup is “C:\Program Files\Parallels\Plesk\Backup\”. Go ahead and change it to a location of your wish, say “E:\Backup”
Windows 64 bit edition
Again it’s the registry only, but the location may be a bit different. You need to browse to
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PLESK\PSA Config\Config
And repeat the steps mentioned above. If you cant find these keys, search for the “DUMP_D” without quotes and update it.
Linux 32/64 bit editions
#vi /etc/psa/psa.conf
Find the following variable, DUMP_D and edit the server backup repository directory PATH as you wish. Default Directory Path for Plesk Backup is “/var/lib/psa/dumps” You may change it to /media/backups
# Backups directory
DUMP_D /var/lib/psa/dumps
Okay. Those were the steps of a sysadmin not so greenhorn. If you are not comfortable with running regedit, use Plesk Panel Reconfigurator.
By using Parallels Plesk Panel Reconfigurator you can move the Parallels Plesk Panel backup files storage directory to another location on the same or another partition.
To change location of the backup files directory, follow these steps:
1. Run Parallels Plesk Panel Reconfigurator and select the Change Plesk Backup Data location option.
2. Specify the destination directory name. If the directory does not exist, it will be created.
3. Click Next. During this operation all Parallels Plesk Panel services will be restarted.
A particular website of a client was getting “Service Unavailable” message for just one website in a Plesk server while all other website was working fine. No logs in Event Viewer were giving any clue. However when someone changed the Application pool to use the shared pool plesk(domain2.0)pool, it was working fine which deserted the issue to application pool issue.
Approach to the solution
“%plesk_bin%”\dbclient –direct-sql –sql=”select su.login, a.password from accounts a, sys_users su where a.id=su.account_id and su.login=’username’ ”
login password
username password
where username is an owner of the domain, which can be taken from Plesk => Domains => Web Hosting Settings
net user IUSR_username password