Linux self-study note--lamp simple configuration

Source: Internet
Author: User

1.HTTPD Configuration

(1) Basic settings

Listen 80 Port

Documentroot/var/www root directory

DirectoryIndex index.html Home

alias/icon/"/download/newicon" path alias

ErrorDocument 404/missing.html 404 File

Extendestatus on 220 lines, status page, define specific in 920 or so

(2) Access control

<directory "/var/www/html" >

Options Indexes FollowSymLinks

AllowOverride None

Order Allow,deny

Allow from all

</Directory>

Indexes: If the page is inaccessible, provide a list of structures that should be commented out

FollowSymLinks: If a file in the root directory is linked to a non-directory, the default is failure, setting this to leave the link out of the directory limit

AllowOverride: Whether to allow. htaccess Feature Overlay

Order:allow,deny open all, rejecting specific conditions. Deny,allow reject all, open specific conditions

Allow|deny from x.x.x.x: Allow or deny a specific URL or network segment

(3) Persistent connection

KeepAlive On|off

KeepAliveTimeout 15 default, not too high

Maxkeepaliverequests 500 default 100, maximum number of timeout requests

Pros: Handle multiple requests at a time, without having to establish a TCP request for each small picture

Cons: Large concurrent server, subsequent requests may not respond in a timely manner

(4) Mpm

Prefork: Multi-process Model

Worker: Multi-process multithreaded model

Pstree | grep ' httpd ' can see the exact difference

Configuration file: centos6/etc/sysconfig/httpd

Centos7/etc/httpd/conf.modules.d/00-mpm.conf

(5) The virtual host needs to comment out DocumentRoot

Distinguish different websites based on IP or port

<virtualhost 192.168.1.10:80>

ServerName www.mage.com

DocumentRoot '/www/mage.com/htdocs '

</VirtualHost>

-------------------------------------------------

Based on hostname, you need to set DNS or hosts file parsing

Namevirtualhost 192.168.1.10:80 Note 2.4 not required

<virtualhost 192.168.1.10:80>

ServerName www.mage.com

Document '/www/mage.com/htdocs '

</VirtualHost>

<virtualhost 192.168.1.10:80>

ServerName www.niaoge.com

Document '/www/niaoge.com/htdocs '

</VirtualHost>


2.mariadb

(1) Admin password: mysqladmin-uroot password 123

(2) Change admin password: mysqladmin-uroot-p123 Password

(3) Authorization: Grant all on dbname.tbname to ' user ' @ ' ipaddr ' identified by ' password ';

Use arbitrary data: *. *

Any address:%

(4) Modify user password:

Use MySQL;

Update user set Password=password (' 456 ') where user= ' root ';

Flush privileges;

(5) Rejection of anti-parsing/etc/my.cnf

[Mysqld]

Skip_name_resolve=on;

3. Compile and install lamp

(1) httpd

./configure--PREFIX=/USR/LOCAL/HTTPD

--sysconfdir=/etc/httpd

--WITH-APR=/USR--WITH-APR-UTIL=/USR

(2) mariadb

Copy support-files under Configuration file to/etc/mysql/my.cnf, copy Mysql.server to/etc/init.d/mysqld

Chkconfig--add mysqld

Initialize the database, use scripts/mysql_install_db--user=mysql under/usr/local/mysql--datadir=/path

(3) PHP

./configure--prefix=/usr/local/php

--with-mysql=/usr/local/mysql

--with-mysqli=/usr/local/mysql/bin/mysql_config

--with-config-file-path=/etc

--with-config-file-scan-dir=/etc/php.d

--WITH-APXS2=/USR/LOCAL/HTTPD/BIN/APXS will be compiled into modules using

Linux self-study note--lamp simple configuration

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.