VM builds lamp and LAN access

Source: Internet
Author: User
Tags install php password protection
1.apache:
[Root@localhost liuhan]# Yum Install httpd
...

Start
[Root@localhost liuhan]#/etc/init.d/httpd start
Starting httpd:

View Run status
[Root@localhost liuhan]#/etc/init.d/httpd Status
HTTPD (PID 2633) is running ...

http://localhost or http://127.0.0.1, see the Apache 2 Test page page.

Modify configuration file: Modify listening port-> 8080
[Root@localhost liuhan]# nano/etc/httpd/conf/httpd.conf
...
#Listen 12.34.56.78:80
Listen 8080

Restart Service
/ETC/INIT.D/HTTPD restart

Apache2 This version of the structure:
/etc/httpd/conf/httpd.conf: The most important configuration file;
/etc/httpd/conf.d/*.conf: This is the CentOS feature, if you do not want to modify the original configuration file httpd.conf, the other configuration of this stand-alone configuration, the launch of Apache, this file will be read into the main configuration file;
/usr/lib/httpd/modules:apache support a lot of modules, you want to use the module by default are placed in this directory;
/var/www/html: Here is the CentOS default "home" directory;
/var/www/error: The default system error message, host settings error or browser-side requirements of the data error, the browser appears on the error message is mainly the information here;
/var/www/icons: Provides some small icons of Apache;
/var/www/cgi-bin: Default to some executable CGI programs placed in the directory;
/VAR/LOG/HTTPD: Log file directory, the file here is very easy to change a lot, need to provide enough space;
/usr/sbin/apachectl: This is the main execution file of Apache, this execution file is actually shell script, it can be active to detect some set value on the system, so that when you start Apache is simpler;
/USR/SBIN/HTTPD: This is the main Apache binary file;
/USR/BIN/HTPASSWD: When you want to log on to some Web pages, you need to enter your account and password. So Apache itself provides a basic password protection method, which is generated by this command.

2.mysql:
[root@localhost liuhan]# yum install MySQL Mysql-server
...

Start MySQL
[Root@localhost liuhan]#/etc/init.d/mysqld start
Starting mysqld: [OK]

Set a password for the root user
[root@localhost liuhan]# mysqladmin-u-root-p password Liuhan@big
Enter Password:
Mysqladmin:can ' t turn off logging; Error: ' Access denied; You are need the SUPER privilege for this operation '

[Root@localhost liuhan]#/etc/init.d/mysqld Stop
Stopping mysqld: [OK]

Start
mysql> Update user Set Password=password (' Liuhan@9 ') where user= ' root ';
Query OK, 3 Rows Affected (0.00 sec)
Rows Matched:3 Changed:3 warnings:0

mysql> flush Privileges;
Query OK, 0 rows affected (0.01 sec)

Mysql> quit
Bye
[Root@localhost liuhan]# mysql-u root-p
Enter Password:
...
Mysql>

MySQL has several important directories and files:
/ETC/MY.CNF: This is the MySQL configuration file, including the MySQL database optimization;
/usr/lib/mysql: This directory is where the MySQL database is placed, and be sure to back it up in a complete backup.

3,php:
[root@localhost liuhan]# Yum Install PHP

Then you need to restart Apache:
[Root@localhost liuhan]#/etc/init.d/httpd Restart
Stopping httpd:

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.