RedHatLinux network server architecture practice (6)

Source: Internet
Author: User
Article Title: RedHatLinux network server architecture practice (6 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
4 test Resin
# Start Resin
Shell> resin start
# Restart Apache because httpd. conf has just been modified and takes effect only after restart.
Shell> apache restart
# Creating files
Touch/home/www/index. jsp
Chown-R www/home/www/index. jsp
Chmod 701/home/www/index. jsp
# Edit source files
Vi/home/www/index. jsp
# The Source Code contains only one sentence:
1 + 1 = <% = 1 + 1%>
# Test the program
Lynx http://www.yesgo.loc/
# The output result should be: 1 + 1 = 2
  
5. Create a STARTUP script
# Creating a Resin service is the same as creating MySQL and Apache services. However, you must set the relevant environment variables here.
# Create a script file
Touch/etc/rc. d/init. d/resin
# Change File Permissions
Chmod 701/etc/rc. d/init. d/resin
# Connection startup level
Ln-s/etc/rc. d/init. d/resin/etc/rc. d/rc5.d/S70resin
# Edit the Startup Script
Vi/etc/rc. d/init. d/resin
  
# The file content is as follows:
  
#! /Bin/bash
# Set environment parameter:
  
JAVA_HOME =/usr/local/jvm
  
RESIN_HOME =/usr/local/resin
  
CLASS_HOME =/usr/local/lib/java
  
CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib/tools. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/jre/lib: $ RESIN_HOME/lib: $ CLASS_HOME/drivers/mm.mysql-2.0.4-bin.jar.zip: $ CLASS_HOME/jaf/activation. jar: $ CLASS_HOME/javamail/mail. jar: $ CLASS_HOME/javamail/smtp. jar: $ CLASS_HOME/javamail/pop3.jar: $ CLASS_HOME/javamail/mailapi. jar: $ CLASS_HOME/javamail/imap. jar
  
PATH = $ PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin: /usr/local/jvm/bin:/usr/local/jvm/jre/bin:/usr/local/mysql/bin:/usr/bin/X11: /usr/X11R6/bin
  
Export JAVA_HOME RESIN_HOME CLASS_HOME CLASSPATH PATH
  
# Start resin web server
Exec/usr/local/resin/httpd. sh start
  
Step 15 PhpMyAdmin install
  
# PhpMyAdmin is my favorite MySQL client tool. I have also used other clients, including win32 DBTools, mysqlfront, and other web-based tools. However, I finally found that phpMyAdmin is still irreplaceable. It is based on web versatility, no installation, multiple users, platform independence, stability, open source code, and extremely fast upgrade speed. In addition, this document focuses on server configuration, so I will only introduce phpMyAdmin here.
  
1 configure DNS
Vi/var/named/yesgo. loc
# Append the following line. Of course, you can customize other aliases or host names.
Mysql in cname ns. yesgo. loc.
  
/Etc/rc. d/init. d/named restart // restart the DNS Service
Nslookup // test whether the resolution is successful
  
2. Create an FTP
# When installing MySQL, we have created an account called mysql. If you have not created an account, follow the following statement to create one:
Useradd mysq-s/dev/null-g ftpchroot
Passwd mysql
  
3. Install phpMyAdmin
Tar xvzf/home/src/phpMy *
Cp/home/src/phpMyAdmin/*/home/mysql
Chown-R mysql/home/mysql
Chown-R mysql/home/mysql /*
Chmod 701/home/mysql
Chmod 701/home/mysql /*
  
4. Add a VM
Vi/usr/local/apache/conf/httpd. conf
  
<VirtualHost mysql. yesgo. loc>
ServerAdmin webmaster@yesgo.loc
DocumentRoot/home/mysql
ServerName mysql. yesgo. loc
ErrorLog logs/mysql. yesgo. loc-error_log
CustomLog logs/mysql. yesgo. loc-access_log common
</VirtualHost>
  
5. Add Authentication
# Add a MySQL user
# To use the authentication function, phpMyAdmin requires a startup user who has the query permission on the mysql related tables. The specific definitions are as follows:
Shell> mysql-p
Mysql> grant usage on mysql. * TO '<stduser>' @ 'localhost' identified by '<stdpass> ';
Mysql> grant select (Host, User, Select_priv, primary, Update_priv, Delete_priv, Create_priv, Drop_priv, primary, File_priv, Grant_priv, primary, Index_priv, Alter_priv) ON mysql. user TO '<stduser>' @ 'localhost ';
Mysql> grant select on mysql. db TO '<stduser>' @ 'localhost ';
Mysql> grant select (Host, Db, User, Table_name, Table_priv, Column_priv) ON mysql. tables_priv TO '<stduser>' @ 'localhost ';
Vi config. inc. php
  
  
$ Incluservers [1] ['host'] = 'localhost'; // host name
$ Export servers [1] ['Port'] = '000000'; // default port
$ Pipeline servers [1] ['socket '] = ''; // The socket path used
$ Consumer servers [1] ['connect _ type'] = 'tcp '; // use tcp or socket to connect
$ Incluservers [1] ['stduser'] = ''; // standard user account name
$ Login servers [1] ['stdpass'] = ''; // password of the standard account
$ Login servers [1] ['auth _ type'] = 'http'; // specify whether the authentication method is config, http, or cookie. This is a change in version 2.2.3, http verification is a safer method.
$ Login servers [1] ['user'] = 'root'; // MySQL account
$ Login servers [1] ['Password'] = ''; // this parameter is required only when config authentication is used.
$ Login servers [1] ['only _ db'] = ''; // If you specify a database here, the system will only list this database on the left after logging in.
  
6. Test phpMyAdmin.
Apache restart
Lynx http://mysql.yesgo.loc // client browser is recommended for testing
  
Step 16 Server Test
  
# Why not use 1 + 1 = <% = 1 + 1%> or <% out. print ("Hello World! "); %> What about this example? In this example, we can only test whether Apache and Resin can work together, but not whether database connection, JDBC2.0 support, and whether Chinese problems exist. The following are four examples. The first example can test all the above problems. The second example shows you how to use the Resin connection pool. The third example shows you how to call components, how to separate the data layer from the processing layer; the fourth example is used to test PHP.
  
Example 1: Use a connection string to connect to a database
  
1. Create a database
# The database script is as follows, which can be stored as a. SQL file and then generated by phpMyAdmin
# Note that the database will be used in the following example.
Create database yesgo
Use yesgo;
  
Create table prov
(
Prov_id tinyint (2) not null primary key,
Prov_name char (6) not null
);
  
Insert into prov values ('01', 'anhui ');
Insert into prov values ('02', 'beijing ');
Insert into prov values ('03', 'chongqing ');
Insert into prov values ('04 ', 'fujian ');
Insert into prov values ('05 ', 'gansu ');
Insert into prov values ('06', 'guangdong ');
Insert into prov values ('07 ', 'guangxi ');
Insert into prov values ('08', 'guizhou ');
Insert into prov values ('09', 'hainan ');
Insert into prov values ('10', 'hebei ');
Insert into prov values ('11', 'heilongjiang ');
Insert into prov values ('12', 'henan ');
Insert into prov values ('13', 'hubei ');
Insert into prov values ('14', 'hunan ');
Insert into prov values ('15', 'inner Mongolia ');
Insert into prov values ('16', 'jiangsu ');
Insert into prov values ('17', 'jiangxi ');
Insert into prov values ('18', 'jilin ');
Insert into prov values ('19', 'liaoning ');
Insert into prov values ('20', 'ningxia ');
Insert into prov values ('21', 'qinghai ');
Insert into prov values ('22', 'shanxi ');
Insert into prov values ('23', 'shaanxi ');
Insert into prov values ('24', 'shandong ');
Insert into prov values ('25', 'shanghai ');
Insert into prov values ('26', 'sichuan ');
Insert into prov values ('27', 'tianjin ');
Insert into prov values ('28', 'tibet ');
Insert into prov values ('29', 'xinjiang ');
Insert into prov values ('30', 'yunnan ');
Insert into prov values ('31'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.