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
# 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
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'
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.