Archive for the ‘System Administration’ Category

A simple permanent (301) redirect using RedirectMatch in .htaccess

Wednesday, October 7th, 2009
RedirectMatch permanent /old-location/.* http://sub.domain.com

Related

Drupal 6 installation problem stopped on database configuration settings step

Wednesday, March 18th, 2009

Today when I tried to install drupal but the installation wizard couldn't continue.

Solution:
Edit /sites/default/settings.php and change

$db_url = 'mysql://username:password@localhost/databasename';

to the actual db settings and then reload the page (CTRL+R) or press F5 in your browser.

Good Luck

Solution to Mail disappear in Mac OS X (Mail.app) (Overstuffed mailbox problem)

Tuesday, March 17th, 2009

It seems if you have too many files in your Mail.app message could disappear (visually)

Apple has calls it "Overstuffed mailbox is unexpectedly empty"

Reason:
---
How large does the mailbox have to be for this to happen? With Mac OS X 10.4 or later, 2.0 GB or larger. With Mac OS X 10.
3 through 10.3.9, there's not a specific size where this will always occur--the mailbox could be anywhere from a few hundr
ed megabytes (MB) to over a gigabyte (GB) large. However, the bigger your mailbox (or combination of mailboxes) is, the mo
re likely it is this could occur.

---

Apple suggest these steps:

* Update to the latest version of Mac OS X 10.3 or 10.4. Even if this works, check out "How can I prevent it from happ
ening again?" below.
* From the Mailbox menu, choose Rebuild.
* Quit Mail and open it again. If Mail had been open a while, this might help. Even if this works, check out "How can
I prevent it from happening again?" below.
* If you use more than one account, for example "Account 1" and "Account 2", instead of clicking on the "In" mailbox,
click on either "Account 1" or "Account 2" that appear beneath "In" (as well as beneath Sent and Trash, for example). That
way you'll only see messages related to that specific account. If your two account mailboxes are big individually, but no
t big enough to cause this issue, when viewed together (by just clicking "In" for example), the issue may occur.

Related:

Setting up php, mysql, phpMyAdmin on Friday 13th

Friday, March 13th, 2009

I start setting up my new machine - Sony VAIO and this time it didn't go well the first time.
Keep reading...

I downloaded the latest php (PHP 5.2.9-1 (cli) (built: Mar  5 2009 20:02:28),
mysql (mysql-5.1.32-winx64.msi) and phpmyadmin (phpMyAdmin-3.1.3-english.tar.bz2).

Round #1
When I first logged in I saw a warning at the bottom of the first screen of phpmyadmin

Your PHP MySQL library version 5.0.50a differs from your MySQL server version 5.1.32.
This may cause unpredictable behavior.

Because I was already using the latest php I decided to downgrade MySQL to 5.0.51a

Round #2
http://downloads.mysql.com/archives.php?p=mysql-5.0&v=5.0.51a

Round #2.5
For some strange coinsidence (or maybe because it's Friday 13th :D) the configuration
wizard wouldn't start.

The error was caused by a bad configuration setting in MySQLInstanceConfig.exe.
By the way I have disabled UAC because of the constant prompting is quite
annoying but I still like Windows ;) (This was for my friends who like Mac).

MySQLInstanceConfig.exe Error in manifest or policy file on line 6.
The value "
asAdministrator" of attribute "level" in requestedPrivileges" is invalid.

Here is how to fix it by editing the file resource using Resource Hacker program (free).
http://bugs.mysql.com/bug.php?id=34340

I am not done yet :D

Round #3
Now the latest phpMyAdmin produced an error:

SHOW PLUGINS

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PLUGINS' at line 1
Open new phpMyAdmin windowOpen new phpMyAdmin window

It seems this is a caching problem (see http://www.wampserver.com/phorum/read.php?2,46184,46227 )
Restart your browser and try again.

Happy Web Development ;)

Related:

How to run a cron job every 6 hours ?

Tuesday, February 10th, 2009

It is very ofter for a every normal person to run scheduled jobs.

This could be backups, some processing that takes a lot of time etc.

Here is how to run a cron job every 6 hours

[code]
#min  hour day/month   month   day/week
0 */6 * * * /home/user/script.sh
[/code]

Have you tried to use "*" instead of 0 for the minutes ? ;) :D
I did and received a lot of emails ... it was working.

Related:

http://www.linuxforums.org/forum/redhat-fedora-linux-help/117506-running-crontab-every-7-hours.html

How to solve Error 403 / Forbidden on Fedora Core 10 at Slicehost

Sunday, February 8th, 2009

I played with lighttpd web server on my Fedora core 10 Slice and I was getting the annoying Error 403 error while accessing a simple phpinfo file.

Solution:
Login as root

[code]
vi /etc/lighttpd/lighttpd.conf
[/code]

Enable modules:

[code]
"mod_fastcgi"
"mod_simple_vhost"
[/code]

Setup a site and creates folders if they do not exist

[code]
simple-vhost.server-root   = "/var/www/vhosts/"
simple-vhost.default-host  = "domain.com"
simple-vhost.document-root = "/htdocs/"
[/code]

Enable fastcgi
[code]
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)
[/code]

Also look for "url.access-deny" and make sure it does not contain a .php extension.

Restart the lighttpd server

[code]
/etc/init.d/lighttpd restart
[/code]

I assume that you've already executed

Disable apache and install

[code]
service httpd stop
chkconfig httpd off

yum install lighttpd
chkconfig lighttpd on
[/code]

How to open port 80/http and 443/https on Fedora Core 10 at Slicehost

Friday, February 6th, 2009

Login as root

[code]
# vi /etc/sysconfig/iptables
[/code]
Add these lines
[code]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
[/code]

Restart iptables

[code]
# /etc/init.d/iptables restart
[/code]
Related:
http://www.cyberciti.biz/faq/linux-iptables-firewall-open-port-80/

To become a Slicehost customer please go to: slicehost.com

How to install new or replace an existing certificate in Plesk or Obtaining and Installing SSL Certificates from Other Certification Authorities in Plesk

Wednesday, November 5th, 2008

Here is a quick an SSL certificate howto.

Feel free to share improvements :)

0. Go to Select domain Domains > domain.com  > Certificates > Add New Certificate
1. Generate CSR
2. Send it to Certificate Authority
3. When the certificate is ready => Upload the key OR paste it in the box (I assumed that you've followed the same path that you've used to generate the certificate request -> Step 0)
4. Go to Domains > domain.com > Setup
5. Select the certificate from the drop-down box after "Certificate"
6. Click OK

------ This is from the help section of Plesk -----
Obtaining and Installing SSL Certificates from Other Certification Authorities

To secure a site with an SSL certificate from other certificate authorities:

1. Click the Domains shortcut in the navigation pane.
2. Click the required domain name in the list.
3. Click Certificates in the Services group. A list of SSL certificates that you have in your repository will be displayed.
4. Click Add New Certificate.
5. Specify the certificate properties:
* Certificate name. This will help you identify this certificate in the repository.
* Encryption level. Choose the encryption level of your SSL certificate. We recommend that you choose a value more than 1024 bit.
* Specify your location and organization name. The values you enter should not exceed the length of 64 symbols.
* Specify the domain name for which you wish to purchase an SSL certificate. This should be a fully qualified domain name. Example: www.your-domain.com.
* Enter the domain administrator's e-mail address.
6. Make sure that all the provided information is correct and accurate, as it will be used to generate your private key.
7. Click Request. Your private key and certificate signing request will be generated and stored in the repository.
8. In the list of certificates, click the name of the certificate you need. A page showing the certificate properties opens.
9. Locate the CSR section on the page, and copy the text that starts with the line -----BEGIN CERTIFICATE REQUEST----- and ends with the line -----END CERTIFICATE REQUEST----- to the clipboard.
10. Visit the Web site of the certification authority from which you want to purchase an SSL certificate, and follow the links on their site to start a certificate ordering procedure. When you are prompted to specify CSR text, paste the data from the clipboard into the online form and click Continue. The certification authority will create an SSL certificate in accordance with the information you supplied.
11. When you receive your SSL certificate, save it on your local machine or network.
12. Return to the SSL Certificates repository (Domains > domain name > Certificates).
13. Click Browse in the middle of the page and navigate to the location of the saved certificate. Select it, and then click Send File. This will upload and install the certificate against the corresponding private key.
14. Return to the domain's administration screen (Domains > domain name) and click Setup in the Hosting group.
15. Select the SSL certificate that you wish to install from the Certificate drop-down box.

If there is no Certificate drop-down box on the screen, this means that you are on a shared hosting account; therefore, you need to upgrade your hosting package and purchase a dedicated IP address from your provider.
16. Select the SSL support check box and click OK.

How to mount a shared folder read/write permissions

Saturday, November 1st, 2008

Once I need to mount a Windows share on my Ubuntu Server.

By default the folder was mounted as readonly but I fixed that by supplying dmask=777,fmask

Here is the command I used.

[code]

mount -t smbfs -o username=guest,password=,dmask=777,fmask=777 //192.168.0.10/myshare /mnt/existing_folder/

[/code]

If you have any ideas or if I can add something and/or improve this article do leave a comment.

Thanks.

Slavi

Apache mod_rewrite redirect for non secure requests to secure www. subdomain

Wednesday, October 29th, 2008

In many cases SSL certificates are issued for the "www." domain.
Then you'll want to have all links pointing to "www." domain otherwise you'll see Firefox's error message:

"Secure Connection Failed. The certificate is only valid for www.domain.com"

[code]
RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]

RewriteRule .* https://www.domain.com%{REQUEST_URI} [QSA,R=301,L]

[/code]