yum安裝nginx-php-mysql二進位制
參考:http://nginx.org/en/linux_packages.html
#1 配置repo源
$ cat /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
#2 安裝
yum install nginx
/etc/init.d/nginx start
#3 測試
curl 192.168.119.130
#4 nginx配置檔案:
mkdir /data/log/svr/nginx -p
vi /etc/nginx/nginx.conf
user nginx;
worker_processes 4;
error_log logs/error.log notice;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main `$remote_addr – $remote_user [$time_local] “$request” `
`$status $body_bytes_sent “$http_referer” `
`”$http_user_agent” “$http_x_forwarded_for”`;
access_log /data/log/svr/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_body_temp_path /tmp;
client_max_body_size 500m;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 300;
fastcgi_read_timeout 3600;
fastcgi_buffer_size 400k;
fastcgi_buffers 16 1m;
fastcgi_busy_buffers_size 10m;
fastcgi_temp_file_write_size 20m;
fastcgi_intercept_errors on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_disable “MSIE [1-6].”;
gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
include conf.d/*.conf;
}
3)虛擬主機
配置檔案都在這個目錄下:
/etc/nginx/conf.d/
$ cat /etc/nginx/conf.d/abc.com.conf
server {
listen 127.0.0.1:80;
server_name www.abc.com;
root /data/website/abc;
access_log /data/log/www/abc.access.log main;
}
$ mkdir /data/log/www -p
> /data/log/www/abc.access.log
mkdir /data/website/abc -p
使用php需要的配置
$ cat /etc/nginx/conf.d/test.com.conf
server {
listen 127.0.0.1:80;
server_name www.test.com;
root /data/website/test;
charset utf-8;
access_log /data/log/www/test.access.log main;
location / {
index index.php;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
$ > /data/log/www/test.access.log
mkdir /data/website/test -p
###安裝php
yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php54w php54w-bcmath php54w-cli php54w-common php54w-devel php54w-fpm php54w-gd php54w-imap php54w-ldap php54w-mbstring php54w-mcrypt php54w-mysql php54w-odbc php54w-pdo php54w-pear php54w-pecl-igbinary php54w-xml php54w-xmlrpc php54w-opcache php54w-intl php54w-pecl-memcache
############################# php nginx mysql 安裝
###3 nginx 安裝
http://wiki.nginx.org/Install
vi /etc/yum.repos.d/CentOS-Base.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install nginx -y
cd /etc/nginx
cp nginx.conf nginx.bac
egrep -v `#|$^` nginx.conf > nginx.conf.r
mv nginx.conf.r nginx.conf
/etc/init.d/nginx start
cat /var/run/nginx.pid
pgrep -o nginx
curl -I 192.168.119.130
###4 php(5.4) 安裝
yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php54w php54w-bcmath php54w-cli php54w-common php54w-devel php54w-fpm php54w-gd php54w-imap php54w-ldap php54w-mbstring php54w-mcrypt php54w-mysql php54w-odbc php54w-pdo php54w-pear php54w-pecl-igbinary php54w-xml php54w-xmlrpc php54w-opcache php54w-intl php54w-pecl-memcache
php -v
###5 mysql 安裝
mysql安裝為什麼大部分使用二進位制安裝。而不是原始碼手動去編譯?
mysql使用的glibc進行開發的。glibc庫是一個底層api,所以只要是linux,都會有glibc庫。
所以,mysql安裝不需要考慮環境是否符合要求。移植性很方便。直接將編譯好的二進位制程式碼複製到另外一個機器上,也是可以用的。
二進位制安裝
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.25-linux-glibc2.5-x86_64.tar.gz
groupadd mysql
useradd -g mysql mysql
檢查並解除安裝
rpm -qa|grep mysql
rpm -e mysql
rpm -e –nodeps mysql-libs-5.1.73-5.el6_6.x86_64
解壓安裝
tar -zxvf mysql-5.6.25-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -s mysql-5.6.25-linux-glibc2.5-x86_64/ mysql
cd /usr/local/mysql
chown -R mysql.mysql .
初始化資料庫
yum install libaio-dev*
或者
yum install -y libaio-devel
mkdir /mysql/mysqldata -p
cd /usr/local/mysql
./scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/mysql/mysqldata
cp support-files/my-default.cnf /etc/my.cnf
vi /etc/my.conf
[client]
socket = /mysql/mysqldata/mysql.sock
[mysqld]
basedir = /usr/local/mysql
datadir = /mysql/mysqldata
port = 3306
server_id = 111
socket = /mysql/mysqldata/mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
修改環境變數
vi /etc/profile
PATH=/usr/local/mysql/bin/:$PATH
export PATH
. /etc/profile
echo $PATH
啟動mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod u+x /etc/init.d/mysqld
chkconfig –add mysqld
/etc/init.d/mysqld start
tail -f /usr/local/mysql/data/mode.err
mysql -S mysql.sock
mysqld_safe
========================= 生成案例優化配置檔案
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M – 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the “–help” option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /data/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /data/mysql/mysql.sock
user = mysql
character_set_server = utf8
collation_server = utf8_general_ci
pid-file = /data/mysql/3306.pid
datadir = /data/mysql/data
tmpdir = /data/mysql/tmp
max_allowed_packet = 128M
max_connections = 2000
max_connect_errors = 1000
#Query Cache
query_cache_type = 0
query_cache_size = 256M
query_cache_limit = 2M
query_cache_min_res_unit = 2K
#Common
skip-name-resolve
lower_case_table_names=1
back_log = 512
table_open_cache = 2048
thread_cache_size = 256
thread_concurrency = 16
#Error Log
log-error=../logs/error.log
log_warnings = 2
#Slow Query Log
slow_query_log_file=../logs/slow.log
long_query_time=1
slow_query_log=1
#General Query Log
general_log_file =../logs/general.log #查詢日誌,通常只有特殊情況才開啟。
general_log = 0 #不啟用查詢日誌
#Relay Log
relay_log = ../logs/relay-bin
#binlog
log-bin=../logs/mysql-bin
binlog_cache_size = 2M
max_heap_table_size = 64M
log-bin-trust-function-creators
binlog-format = statement
#expire_logs_days=7
#Session variables
sort_buffer_size = 2M
join_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
read_rnd_buffer_size = 256k
thread_stack = 192K
tmp_table_size = 64M
bulk_insert_buffer_size = 16M
#Innodb
innodb_file_per_table=1
innodb_data_home_dir = /data/mysql/data
innodb_log_group_home_dir = /data/mysql/data
default-storage-engine = innodb
transaction_isolation = REPEATABLE-READ
innodb_additional_mem_pool_size = 64M
innodb_buffer_pool_size = 5G
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_file_io_threads = 16
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_log_file_size = 300M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 60
innodb_lock_wait_timeout = 50
innodb_thread_concurrency = 16
innodb_flush_method=O_DIRECT
innodb_stats_on_metadata=0
innodb_change_buffering=inserts
innodb_adaptive_flushing=1
innodb_io_capacity=3000
innodb_open_files= 2048
#MyISAM
key_buffer_size = 512M
read_buffer_size = 16M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 128M
myisam_repair_threads = 1
myisam_recover
#Memory variables
max_heap_table_size = 64M
#Replication
server-id = 2043306
relay_log_info_file=relay-log.info
master-info-file=master.info
relay-log-purge = 1
#skip_slave_start=0
#replicate-do-db = cdned
#replicate-do-db = cdnms
log-slave-updates
relay-log-recovery =1
replicate-ignore-db = mysql
#auto for dual master
auto_increment_offset = 1
auto_increment_increment = 2
#Timeout
connect_timeout=10
delayed_insert_timeout =300
lock_wait_timeout = 120
innodb_rollback_on_timeout=OFF
#net_read_timeout=30
#net_write_timeout=60
#slave_net_timeout=30
#interactive_timeout=2048000
[mysqldump]
quick
max_allowed_packet = 256M
[mysql]
no-auto-rehash
prompt=[u@d R:m]>
default-character-set =utf8
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 81920
本文轉自cloves 51CTO部落格,原文連結:http://blog.51cto.com/yeqing/1649689
相關文章
- MySQL 5.7 原始碼安裝、Yum倉庫安裝、RPM安裝、二進位制安裝MySql原始碼
- MySQL 安裝指南 二進位制安裝MySql
- PostgreSQL二進位制安裝流程SQL
- Mysql二進位制包安裝MySql
- MySQL linux二進位制安裝MySqlLinux
- 二進位制檔案安裝安裝etcd
- mysql安裝-----二進位制包安裝及解除安裝MySql
- Mysql for Linux安裝配置之——二進位制安裝MySqlLinux
- centos 7 二進位制安裝mysql 5.7.25CentOSMySql
- PostgreSQL 10.23 二進位制安裝SQL
- 使用二進位制包來安裝MySQLMySql
- ubuntu mysql5.6二進位制安裝UbuntuMySql
- MySQL5.7 windows二進位制安裝MySqlWindows
- 二進位制方式安裝mysql 5.6.15MySql
- 03二進位制包安裝與介紹
- 二進位制方式安裝 k8sK8S
- RHEL 7.2 安裝二進位制MySQL 5.7.18MySql
- Linux安裝二進位制PHP7.2LinuxPHP
- MySQL5.7 linux二進位制安裝MySqlLinux
- (OEL 6.3) Mysql6.5二進位制安裝MySql
- 二進位制安裝 Docker 以及 Docker ComposeDocker
- centos7二進位制方式安裝rabbitmqCentOSMQ
- Ubuntu 24.04 二進位制安裝 MySQL 8.0.20UbuntuMySql
- CentOS7 安裝 MySQL8.0(二進位制)CentOSMySql
- mysql5.7 for windows二進位制安裝及配置MySqlWindows
- 二進位制發行包還是編譯安裝編譯
- 二進位制與二進位制運算
- 進位制詳解:二進位制、八進位制和十六進位制
- JavaScript 二進位制、八進位制與十六進位制JavaScript
- Postgresql13.1-1 win10二進位制安裝SQLWin10
- centos7搭建lnmp安裝二進位制mysql【三】CentOSLNMPMySql
- Windows11二進位制方式安裝MySQL5.7.44WindowsMySql
- Ubuntu24 二進位制包安裝mysql5.7UbuntuMySql
- (二進位制)
- 二進位制
- 十進位制——二 (八、十六 )進位制
- 二進位制,八進位制,十進位制,十六進位制的相互轉換
- 【進位制轉換】二進位制、十六進位制、十進位制、八進位制對應關係