Ubuntu 14.04 lts Lamp Configuration

Source: Internet
Author: User
Tags mcrypt memcached administrator password apache log mysql backup

First, the goal

Create a server environment that mainly includes:
Apache2.4.7 Server
PHP 5.5.9
Mysql 5.5.49
Extended:
Memcache
Mcrypt

Ii. preparatory work

1. Server System version Ubuntu server 14.04 AMD64

2. Update Source:

Apt-get Update

3. SSH Related Tools Installation:

sudo Install openssh-server openssh-client

To modify the SSH configuration:

vim/etc/ssh/ssh_config

Passwordauthentication No #把前面的注释 # Cancel, yes change to No, so disable all accounts login via password Authentication

Install RZ sz zip for easy code upload:

Install Unzip
III. Environmental Tools Installation

1, amp minimized installation:

sudo Install apache2 php5-mysql libapache2-mod-php5 mysql-server

Install MySQL in the middle of the prompt to set the root administrator password, 2 times after the input continues.

After the installation, self-test is successful.

Configuration file-related directories:

Apache:/etc/apache2

Php5:/etc/php5

Mysql:/etc/mysql

Minimize the installation of PHP to run as a mod, Apache works in Prefork mode, can be configured to optimize related parameters.

Apache2 default directory can be modified/var/www/html

To modify a configuration file:

sudo vim/etc/apache2/apache2.conf

To restart the Apache service:

sudo /etc/init.d/apache2 restart

2. Turn on MySQL remote access

Modify the configuration file/etc/mysql/my.cnf Comment Bind-ip 127.0.0.1

Check that firewall 3306 port is turned on

MySQL Remote authorization:

' username '@'%'password' with GRANT OPTION; #flush privileges;

3, installation memcached

sudo Install memcached

After installing the Memcache server, we need to start the service

sudo  - 11211 -U root

Next install the Memcache client:

sudo Install Php5-memcache

Memcache can be tested after restarting Apache service

4. Install other PHP extensions

sudo Install PHP5

Then press the TAB key to see the PHP extension

sudo Install php5-gd php5-curl

To install the MCrypt extension:

sudo Install php5-/etc/php5/apache2/conf.d/sudoln -S. /.. /mods-available/mcrypt.ini./-sudo service apache2 restart
Iv. Firewall settings
//View firewall SettingssudoUFW Status//turn on the firewallsudoUFW Enable//shutting down the firewallsudoUFW Disable//View firewall rules close all ports by defaultsudoUFW Status Verbose//Open the appropriate portsudoUFW allow AsudoUFW allow thesudoUFW allow3306
V. MySQL backup script

MySQL Backup settings:

1, backup MySQL data at 4 points per day;

2, in order to save space, delete more than 3 months of all backup data;

3, delete more than 7 days of backup data, retain 3 months of 10th number 20th number 30th of the backup data;

#创建shell文件 backup_mysql.sh:

db_pass="password"-uroot-p$db_pass DBNAME >/root/data/mysqlbak/'date +%y%m%d '. SQLFind /root/data/mysqlbak/-mtime +7'*[1-9].sql  'RM -RF {} \; Find /root/data/mysqlbak/-mtime +*.sql'RM - RF {} \;

To create a timed task:

crontab–e 0 4 * * */data/dbdata/backup_mysql. SH
Six. Apache Log configuration

Generate a log file every day:

" |/usr/bin/rotatelogs-l ${apache_log_dir}/access-%y-%m-%d.log 86400 " Common

Ubuntu 14.04 lts Lamp 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.