Tuesday, November 24, 2009

Trouble shooting 503 Access Forbidden error for Drupal

Forbidden You don't have permission to access /drupal/index.php on this server. Server at localhost Port 80

The above is a common error encountered on most Apache installations. You can confirm that you do have read/write permissions to the file by using the below command to check file permissions in a directory(Linux)
#ls -l /path/to/directory containing file

You can change permissions by giving the apache group ownership and read write permissions as shown below:

Adding Apache Group Ownership
#chgrp apache /path/to/directory containing file

changing Group permissions
#chmod g+rw /path/to/directory containing file

If the permissions are in order, then it is time to check the Apache Error Logs

Most of the times, the error is output by the apache server when you try to start it. This can also be checked by checking the httpd error log.
/var/log/httpd/error_log


From the error log, you can tell which module is causing the error. You can temporarily disable the module by editing it out from the Apache config file.

/etc/httpd/conf/httpd.conf

Comment out the the module by adding a '#' before the 'LoadModule ....' line so it becomes

LoadModule log_config_module modules/mod_log_config.so
#LoadModule offendingmodule
LoadModule mime_magic_module modules/mod_mime_magic.so

Restart Apache and see if it works
#apachectl restart

Webmin


Load webmin by typing http://localhost.localdomain:10000/ into your browser
log in with your root username and password.
Then Proceed to system->System Logs->Httpd error log







This helps identify the error.
To Edit out modules causing errors, proceed to Server->Apache Server->Global Configuration->Edit Config Files-> and Edit Directive File in /etc/httpd/conf/httpd.conf.d







comment out the offending module with a "#" as described above, then save and try to start Apache.

Sunday, November 22, 2009

Installing Django on Fedora Linux Apache

NB: This is a deprecated method of running django on apache. A better method can be found at http://docs.djangoproject.com

This tutorial assumes that you have webmin  installed and running. It also assumes that you know how to use su and the webmin . Check previous posts for how to install and configure webmin.

STEPS
  1. Install Apache,Django, mod-python and postgreSQL
  2. yum install apache, mod-python, django, postgresql, postgresql-server

    You can install the above via yumex too.


  3. Start Apache, PostgreSQL via the Webmin module

  4. Make the Directory where your project will be hosted
  5. mkdir /home/projects

  6. Set it as a Django path
  7. cd /home/projects
    /usr/bin/django-admin startproject mysite


  8. Edit the python.conf file
  9. su
    *backup
    cp /etc/httpd/conf.d/python.conf /etc/httpd/conf.d/python.conf.bak

    *edit
    gedit /etc/httpd/conf.d/python.conf

    *Add the following lines
    <location "/mysite/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonDebug On
    PythonPath "['/home/projects'] + sys.path"
    </location>

    *Make sure that you have this line in your configuration and its is not commented out (#)
    LoadModule python_module modules/mod_python.so


  10. Make sure that your site is in the apache aliases . You can add this by going to webmin->servers->Apache Webserver->Default Server->Aliases and Redirects
    Add mysite (or whatever you want to call it) and set the path to /home/projects/mysite


  11. Restart apache
  12. su
    apachectl restart


  13. Go to your browser, type in localhost/mysite (or whatever you called it in the redirects)
Blogged with the Flock Browser

Tuesday, November 10, 2009

Fedora Linux: Apache, MySQL, PostgreSQL ,Webmin Installation and Configuration

Installing other servers and services in Fedora can be a headache, especially without the right tools. There is all the documentation you have to read and all the commands you have to put in via the terminal. all this can be made easier with a few tools.


If you are intending to use Apache2, MySQL and PostgreSQL, you can install them with the appropriate yum commands. Better yet, you can install yumex (To install, type the command yum install yumex as root in the terminal) which is a GUI for yum and gives a simple and fast interface to search, configure, install and update packages.


When installing MySQL and PostgreSQL, make sure that mysql, mysql-server , postgresql, postgresql-server are installed. Several people tend to forget installing mysql-server and get errors when trying to run mysql.


Installing Apache2, MySQL and PostgreSQL is the easy part, configuring them  can be quite hectic. To make configuring them easier, I recommend that you download and install webmin (http://www.webmin.com).

To log in to webmin, use your computer's root username and  password. Webmin is accessed via your browser by accessing your localhost via port 10000, "http://localhost:10000".

Apache
To configure Apache  on webmin, go to the "servers" section on the left tab and select "Apache Webserver".
This gives you an interface for your hosts, inclusive of your virtual servers. From the interface, you can start and stop the apache server on your system. Clicking on a host gives you an interface to configure aliases, hosts, SSL options amongst other configurations.



MySQL
Once you have installed MySQL, you can initialize it and create users via the MySQL module in Webmin. The MySQL module is accessible by clicking on "servers" on the left tab and selecting "MySQL Database Server" Option. From this module, you can start  and stop the MySQL server, create, delete and manage users, create, manage and delete tables. When creating your first MySQL user, you should be careful enough to select all the permissions(under the tab labelled 'Permissions for new users')  (By default it only selects the "select table" permission). Failure to do this will result in you having a user that cannot do anything including create tables. To remedy this, you will have to reset the privileges table( I will post on the procedure later).




As for creating and managing tables, I prefer phpmyadmin, which is a browser(web)based interface for the MySQL server. To install it, use the command "yum install phpmyadmin". To access it, go to your browser and use the adress "http://localhost/phpmyadmin". Log in with the usernames and password that you created in webmin above.

PostgreSQL
PostgreSQL doesn't have a lot to configure, but it can take hours or even days to figure your way around the configuration. Similar to MySQL, webmin has a module for configuring PostgreSQL. The module is under servers on the left tab again.  With this module, you can initialize PostgreSQL (If you are running it for the first time), create and manage users, tables and access permissions.

To access PostgreSQL from other applications, you will need to change the host permission configurations. Under the PostgreSQL module, select that "Allowed Hosts" icon. From the interface that comes up, change the Authentication mode for the local connection to use "MD5 encrypted password".  you can then create a user (other than the default postgres user) from the module.


To manage PostgreSQL, you can install the phpPgAdmin application ( "yum install phpPgAdmin"). To access phpPgAdmin, type in the dress "http://localhost/phpPgAdmin" in your browser (Note the capitalization, phpPgAdmin and phppgadmin are different on Linux). Log in with the username and password you created in the PostgreSQL webmin module.

Have fun with your Fedora Linux Apache MySQL PostgreSQL PHP (Fedora LAMPP) server .

To configure Drupal in fedora, go here.
Blogged with the Flock Browser