Anda di halaman 1dari 4

LAMP CONFIGURATION Steps to uninstall a Apache, MySQL, PHP and PHPMyAdmin: dpkg -l apache mqsql phpmyadmin | grep ^ii

| awk '{print $2}' | xargs sudo apt-get -y purge autoremove dpkg Listing all the packages associated with the names and shows the one which matches the given pattern. grep grep searches for the files that matches a certain pattern and prints it. Packages are listed with ii at first. xargs It is used to build and execute command line from the standard input. They are passed either through ls or pipe. The autoremove keeps the user from having to manually track down each dependency that no longer needed. Removing Apache, PHP5, phpMyadmin and MySQL separately: For Apache: dpkg -l|grep ^grep ^ii| grep apache2 | awk -F' ' '{print $2}' It lists all the packages. With the following remove the packages, sudo apt-get purge & sudo apt-get autoremove For MySQL: dpkg -l|grep ^grep ^ii| grep mysql-server | awk -F' ' '{print $2}' For PhpMyAdmin: sudo apt-get purge libapache2-mod-auth-mysql phpmyadmin Removing db: yes Removing PhpMyAdmin: yes Admin Password: Enter the password correctly which we used to create the db. Installing LAMP on Ubuntu: sudo apt-get install lamp-server^ Note:Caret symbol is very important.

1. It will show the list if packages to be installed 2. It will prompt the user to enter the password to be used for the MySQL database. It will also prompt for second time to confirm it. Test Apache: http://localhost Test PHP : phpinfo() Testing MySQL: cat /etc/myhosts | grep localhost cat /etc/mysql/my.cnf | grep bind-address It should have to match the ipaddress, 127.0.0.1 Installing PHPMyAdmin: sudo apt-get install libapache2-mod-auth-mysql phpmyadmin 1. Please select the web server 2. Use the spacebar to select.(select apache2 from the options apache2 and lighttpd) 3. Next will prompt for the db configuration and ask whether you are a advanced user and can you able to do it manually, Hit OK 4. Then it will prompt for the configuration to new db dbconfig-common 5. Then it asks for the MySQLRoot, password(aspire@321) 6. Then it asks for the confirmation use the same password which we used earlier. If not it will randomly generate a password & make use of it. 7. If we want to confirm it, we can be able to do it on next screen, if the user specifies it. Testing PhpMyAdmin: http://localhost/phpmyadmin/ To set the Document Root: In the sites-available, we have to change the document root for the different sites which we hosted, DocumentRoot. The default one for http is default, the file for https is default-ssl Port can be changed with the listen directive, in the ports.conf. Reloading the apache: sudo /etc/apache2/init.d restart

sudo /etc/apache2/init.d reload sudo /etc/apache2/init.d stop These are commands used to restart, reload and stop the apache server. Inoder to provide the authentication, AuthName "Enter you Login Details" AuthType Basic AuthUserFile /home/poornima/newserver/.htpasswd require user poornima require user geetha These are the information that are need to be stored on the .htaccess file. AuthType can be basic or Digest. If its Digest, MD5 algorithm is used. AuthUserFile specifies the folder in which the password are stored and used for logging in to the directory. Require directive is used to specify the users who are allowed to login. It can be of user, group or validuser. .htpassword is created, The contents can be added with the command, htpasswd -c .htpasswd poornima htpasswd -c .htpasswd geetha PHP is a module in which request is handled by apache file are run as threads. AddType is the which is used process the files which are need to be processed. Loadmodule modulename,- By this we can add the module and configure the directives to be used apply to the directory. Configuring Virtual Hosts:

ServerAdmin Specifies the email address that will be displayed in the error message when error occurs. ServerName specifies the current server name and port. Server Name Alternating name for accessing virtual hosts. NameVirtualHost Designates an IP Address for name-virtual host. Applies to specfic directory when specified in the Directory: Order allow,deny Allow from all Deny from 192.168. FileMatch: Allows to define the access rights for the specific files. Error Log, Transfer Log, Custom Log specifies the location for storing the error log files, access log files, and Custom log file with custom log format. For seeing the log file in the terminal, tail -f /var/log/apache2/access.log ErrorDocument directive is used to specify the error code and the error document associated with it.

Anda mungkin juga menyukai