November 5th, 2007
608Part VRunning Servers8.In the General settings, make sure you set an admin password. Under Locationsand URLs, set the temporary directory to /tmp. The other default settingsshould work, but you can change the look and feel or gallery name to suityour tastes. 9.Tighten the permissions on gallery/.htaccessand gallery/config.php: $ cd ~/public_html/gallery$ sh secure.sh10.You re now ready to start administrating your photo gallery through the Webinterface at http://yourservername/gallery/. Figure 23-3 shows an example photo gallery. Figure 23-3:A sample Gallery installation, with photos. TroubleshootingIn any complex environment, you will occasionally run into problems. This sectionincludes tips for isolating and resolving the most common errors that you mayencounter.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.
Posted in B5 | No Comments »
November 4th, 2007
607Chapter 23Running a Linux, Apache, MySQL, and PHP (LAMP) Server$ cd ~/public_html$ wget http://dl.sourceforge.net/sourceforge/gallery/gallery-1.4.4-pl2.tar.gz$ tar xzf gallery-1.4.4-pl2.tar.gzThe second code line (starting $ wget http:) is too long to fit on one lineinthis book. Just keep typing on one line until you finish .tar.gz, and thenpress Enter. The wgetand tarcommand lines may be different from this example if you usedifferent versions of Gallery. 6.Run the Gallery preconfigure script to set up the necessary file permissions, and create an albums directory that the Web scripts will be able to write to: $ cd ~/public_html/gallery$ sh configure.sh$ mkdir -m 777 ../albums7.Go through the setup process at the Gallery setup page, http://yourservername/gallery/setup/. A screenshot of the Gallery configuration page can beseen in Figure 23-2. The first page tests for all of the necessary programs, whichare available if you installed the prerequisites in step 1. It indicates the installa- tion status. There will be one warning about the compositeprogram not beingfound and another indicating that no additional languages were downloaded. Figure 23-2:The Gallery setup page. Note32_
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.
Posted in B5 | No Comments »
November 4th, 2007
606Part VRunning ServersYou may want to place individual virtual hosts in separate files for convenience. However, you should be careful to keep your primary virtual host in a file that willbe read before the others because the first virtual host receives requests for sitenames that don t match any in your configuration. In a commercial Web-hostingenvironment, it is common to make a special default virtual host that contains anerror message indicating that no site by that name has been configured. Installing a Web Application: GalleryGallery is a Web-based photo gallery management system written in PHP. Throughits Web interface, you can upload pictures to your own photo galleries, which willthen be available on the Web through your LAMP server. Gallery stores its information in data files in your Web directory and does notrequire that MySQL be installed on your server. Despite its many advanced features, such as support for multiple photo albums andautomatic generation of thumbnails, Gallery only takes a few minutes to install onceyour LAMP server has been configured. Before proceeding with this section, youwill need to add a virtual host for Gallery. Then you ll be ready to install Gallery, asshown here: 1.There are several programs that Gallery uses in order to perform imagemanipulation. You can install these using APT: # apt-get install netpbm libjpeg-progs jhead unzip2.Configure your virtual host so that the security features needed by Gallery arepermitted by Apache by adding this to the block in /etc/ apache/conf.d/vhosts.conf: AllowOverride Limit Options FileInfo Be sure to replace usernamewith the name of the user account that owns theWeb documents. 3.Test and reload the Apache HTTP server configuration: # apachectl configtestSyntax OK# apachectl graceful4.Log out of your root account and log in as the user who owns the Web docu- ment folder. 5.Download the latest Gallery version 1.x package from http://gallery. menalto.com/index.phpand extract it to the location where you want tohave it installed. A gallerydirectory under your public_htmlfolder is anideal location: NoteNoteNote32_
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.
Posted in B5 | No Comments »
November 3rd, 2007
605Chapter 23Running a Linux, Apache, MySQL, and PHP (LAMP) ServerNameVirtualHost *:80 ServerName www.example.orgServerAlias web.example.orgDocumentRoot /home/username/public_html/ User usernameGroup groupnameDirectoryIndex index.php index.html index.htm The NameVirtualHostline tells Apache to determine which virtual host to servedocuments from based on the hostname provided by the HTTP client. The *:80means that requests to port 80 on any IP address will be treated in this manner. Similarly, the *:80specification in the VirtualHostblock indicates what address andport this virtual host applies to. The port is optional for both the NameVirtualHostand VirtualHostspecifications but should always be used to prevent interferencewith SSL virtual hosts. The ServerNameand ServerAliaslines tell Apache which names this virtual hostshould be recognized as, so replace them with names appropriate to your site. Youcan leave out the ServerAliasline if you do not have any alternate names for theserver, and you can specify more than one name per ServerAliasline or have mul- tiple ServerAliaslines if you have several alternate names. The DocumentRootspecifies where the Web documents for this site are stored. Ifyou plan to have more than one site per user, you will need to modify this layoutappropriately. Replace usernamewith the name of the account that is administrat- ing the Web site. For this example, each Web site is required to be administered bya different user account. The Userand Grouplines are used by suexecto determine which account to runscripts as. The groupnameparameter should be changed to username s primarygroup. In most modern installations, this is the same as the username. These twolines must be left out if you aren t using suexec. When you are done, use apachectlto check the configuration and then do agracefulrestart: # apachectl configtestSyntax OK# apachectl gracefulUnless you have already created it, you will receive a warning about the public_ htmlnot existing. Run mkdir ~/public_htmlas the user that owns the Website in order to create it. Additional virtual hosts can be added by repeating the VirtualHostblock andrepeating the configuration test (configtest) and reload (graceful) steps. Note32_
Check Tomcat Web Hosting services for best quality webspace to host your web application.
Posted in B5 | No Comments »
November 2nd, 2007
604Part VRunning ServersThree directives commonly found in location blocks and access control files areDirectoryIndex, Options, and ErrorDocument: .DirectoryIndextells Apache which file to load when the URI contains adirectory but not a filename. This directive doesn t work in Files blocks. .Optionsis used to adjust how Apache handles files within a directory. TheExecCGIoption tells Apache that files in that directory can be run as CGIscripts, and the Includesoption tells Apache that server-side includes (SSI) are permitted. Also commonly used is the Indexesoption, which tells Apacheto generate a list of files if one of the filenames found in the DirectoryIndexsetting is missing. An absolute list of options can be specified, or the list ofoptions can be modified by adding +or - in front of an option name. See http:// httpd.apache.org/docs/mod/core.html#optionsfor more information. .ErrorDocumentdirectives can be used to specify which file to send in theresult of an error. The directive must specify an error code and the full URIforthe error document. Possible error codes include 403 (access denied), 404(file not found), and 500 (server internal error). More information about theErrorDocumentdirective can be found at http://httpd.apache.org/docs/ mod/core.html#errordocument. Another common use for location blocks and access control files is to limit accessto a resource. The Allowdirective can be used to permit access to matching hosts, and the Denydirective can be used to forbid it. Both of these options can occurmore than once within a block and are handled based on the Ordersetting. SettingOrderto Deny,Allowpermits access to any host that is not listed in a Denydirec- tive. A setting of Allow,Denydenies access to any host not allowed in an Allowdirective. Like most other options, the most specific Allowor Denyoption for a hostis used, meaning that you can Denyaccess to a range and Allowaccess to subsetsof that range. By adding the Satisfyoption and some additional parameters, youcan add password authentication. For more information about access control, seehttp://httpd.apache.org/docs/mod/mod_access.html. Location blocks (in the generic sense) can be enclosed within a VirtualHostblock. Virtual hosts, which are described in greater detail in the next section, are a conve- nient (and almost essential) tool for altering server behavior based on the serveraddress or name that a request is directed to. Most global configuration options areapplied to virtual hosts but can be overridden by directives within the VirtualHostblock. Adding a Virtual Host to ApacheApache supports the creation of separate Web sites within a single server tokeepcontent separate. Individual sites are configured in the form of virtual hosts, which also are useful when only a single site will be used. Here s how to configureavirtual host: Create a file named /etc/apache/conf.d/vhosts.confusing this template:
Check Tomcat Web Hosting services for best quality webspace to host your web application.
Posted in B5 | No Comments »
November 1st, 2007
603Chapter 23Running a Linux, Apache, MySQL, and PHP (LAMP) ServerDifferent types of location tags exist, and are selected based on the type of resourcelocation that is being specified. The specifier that is included in the start tag will behandled based on the type of location tag. The ones you will generally use andencounter are Directory, Files, and Location. In this chapter, Location refers specifically to the third type of tag, and locationrefers generically to any of the three. .Directorytags are used to specify a path based on the location on the file sys- tem. For instance, refers to the root directory on the computer. Directories inherit settings from directories above them, with the most specificDirectory block overriding less specific ones, regardless of the order in whichthey appear in the configuration files. .Filestags are used to specify files by name. Files tags can be contained withinDirectory blocks to limit them to files under that directory. Settings within aFiles block will override the ones in Directory blocks. .Locationtags are used to specify the URI that is used to access a file or direc- tory. This is different from Directory in that it relates to the address containedwithin the request and not to the real location of the file on the drive. Locationtags are processed last and will override the settings in Directory and Filesblocks. Match versions of these tags DirectoryMatch, FilesMatch, and LocationMatch have the same function but can contain regular expressions in the resource specifi- cation. FilesMatch and LocationMatch blocks are processed at the same time as Filesand Location, respectively. DirectoryMatch blocks are processed after Directoryblocks. Apache can also be configured to process configuration options contained withinfiles with the name specified in the AccessFileNamedirective (which is generallyset to .htaccess). Directives in access configuration files are applied to all objectsunder the directory they contain, including subdirectories and their contents. Accessconfiguration files are processed at the same time as Directory blocks, using a similar most specific match order. Access control files are useful for allowing users to change specific settings withouthaving access to the server configuration files. The configuration directives permittedwithin an access configuration file are determined by the AllowOverridesettingon the directory in which they are contained. Some directives do not make senseat that level and will generally result in a server internal error message when tryingto access the URI. The AllowOverrideoption is covered in detail at http:// httpd.apache.org/docs/mod/core.html#allowoverride. NoteNote32_
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.
Posted in B5 | No Comments »
November 1st, 2007
602Part VRunning ServersEditing Your Apache Configuration FilesThe configuration files for Apache HTTPD are incredibly flexible, meaning that youcan configure the server to behave in almost any manner you want. This flexibilitycomes at the cost of increased complexity in the form of a large number of configu- ration options (called directives), but in practice there are only a few directives withwhich you ll need to be familiar. See http://httpd.apache.org/docs/for a complete list of directives sup- ported by Apache. The Apache configuration is stored in text files that are read by the Apache server, beginning with /etc/apache/httpd.conf. Configuration is read from start to fin- ish, with most directives being processed in the order in which they are read. Additional files may also be read based on the AccessConfig, ResourceConfig, and Includedirectives. On modern installations, the AccessConfigandResourceConfigoptions point to empty files, and the traditional contents ofthosefiles have been moved to the main httpd.conffile. The Includedirective is distinct from AccessConfigand ResourceConfigin thatit can appear more than once and can include more than one file at a time. Files ref- erenced by Includedirectives are processed as if their contents appeared at thelocation of the relevant Includestatement. Includecan point to a single file, to adirectory in which all files are read, or to a wildcard that specifies a specific set offiles within a directory. Subdirectories are also processed when Includepoints to a directory. The scope of many configuration directives can be altered based on context. Inother words, some parameters may be set on a global level and then changed for aspecific file, directory, or virtual host. Other directives are always global in nature, such as those specifying which IP addresses the server listens on, and some arevalid only when applied to a specific location. Locations are configured in the form of a start tag containing the location type anda resource location, followed by the configuration options for that location, and finishing with an end tag. This form is often called a configuration block,and looksvery similar to HTML. A special type of configuration block, known as a locationblock,is used to override settings for specific files or directories. These blocks takethe following form: (options specific to objects matching the specifiergo within this block) NoteNote32_
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.
Posted in B5 | No Comments »
October 31st, 2007
601Chapter 23Running a Linux, Apache, MySQL, and PHP (LAMP) ServerThe installation scripts in the mysql-server package provide you with a couple ofnotices and ask whether you want to remove databases when purging the mysql- server package. No is the safest option because it reduces the chance of accidentallylosing your data. You also are asked whether you want the MySQL server to starton boot. You should probably say Yes here. Access to databases within MySQL is managed based on account information storedwithin the mysql database. As with UNIX systems, the superuser account is namedroot. The default installation does not set a password on this account, and it createsan anonymous account and a test database that should be removed unless you arecertain that you need them: # mysql -u root mysqlWelcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 3 to server version: 4.0.18-logType help; or h for help. Type c to clear the buffer. mysql> UPDATE user SET Password=PASSWORD( newpassword ) -> WHERE User= root ; Query OK, 2 rows affected (0.00 sec) Rows matched: 2 Changed: 2 Warnings: 0mysql> DELETE FROM user WHERE User = ; Query OK, 2 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> DROP DATABASE test; Query OK, 0 rows affected (0.00 sec) mysql> qByeThe UPDATEcommand changes the password for the MySQL root account (replacenewpasswordwith the password you want to use), the DELETEcommand removesthe anonymous user, and the FLUSHcommand tells the running MySQL server toreload the list of user accounts from the database. Finally, the DROPcommandremoves the test database. Operating Your LAMP ServerWith the components of your LAMP server installed and running, you are ready toconfigure Apache and try it out. For this example, Apache is set up to serve contentfor your own domain using a feature called virtual hosting, after which you ll see howto install the Gallery application (http://gallery.menalto.com), which enablesyou to create an online photo gallery on your LAMP server.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.
Posted in B5 | No Comments »
October 30th, 2007
600Part VRunning ServersFigure 23-1:The PHP information page. If, instead of an information page, you are prompted to download the file, check theappropriate PHP installation section (earlier in the chapter) to verify that all thesteps were completed successfully. After everything is tested and working, it s safe to remove the info.phpfile thatyou created: # rm -f /var/www/info.phpInstalling MySQLThe MySQL database system is divided into three main packages: the server, clients, and client libraries. The server is contained within the mysql-server package andrequires the other two to function. APT is aware of this, which means the packageswill be installed automatically when you install mysql-server: Make sure the hostname settings have been configured as described in Chapter 9before installing the mysql-server package. Failure to do so could result in an errorthat will cause the installation to fail. # apt-get install mysql-serverNote32_
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.
Posted in B5 | No Comments »
October 30th, 2007
599Chapter 23Running a Linux, Apache, MySQL, and PHP (LAMP) ServerThis installation process installs Apache version 1.3, and all the configurationexamples here have been tested against it. If you would rather install Apache 2.0, itis available in the apache2-mpm-prefork package and uses libapache2-mod-php4instead of the php4 package mentioned later in this chapter. The server should automatically start once the installation is finished, which meansthat you re now ready to install PHP. Installing PHPNow you re ready to install and test the PHP module in Apache. This is the mostcommon method for installing PHP but introduces some security concerns on multi- user systems because all PHP scripts will be run as the same user as the Apachedaemon. Be sure to read the Security section of the PHP manual at http://php.net/ manual/en/security.phpbefore granting other users access to manipulate PHPfiles on your server. The PHP Apache module is contained in the php4 package, which is installed usingAPT. The following lines download and install the module and the mysql extensions, configure Apache to load the module automatically, and instruct Apache to reloadits configuration: # apt-get install php4 php4-mysql# apache-modconf apache enable mod_php4Replacing config file /etc/apache/modules.conf with new version# apachectl restartDon t worry if the second line does not print out a message as this example shows. That simply means that the module has already been configured. At this point, Apache should be ready to process HTTP requests, complete withprocessing of PHP files. To test it, create a file named /var/www/info.phpcontain- ing a call to the phpinfo()function: # cat > /var/www/info.php ^D# chmod 644 /var/www/info.phpThe ^Dmeans that you should press Ctrl+D on your keyboard. This tells the catcommand that you are at the end of the input. Now try opening the page by goingto http://your server s address/info.php. You should see a page full ofinformation about your Apache and PHP installation, as shown in Figure 23-1. Note32_
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.
Posted in B5 | No Comments »