shell脚本lnmp.sh
环境:centos 6.5 、64位
#!/bin/bash
yum install -y nano vim wget
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum -y install libmcrypt libmcrypt-devel
yum -y groupinstall "Development Tools"
rm -rf atomic RPM-GPG-KEY.art.txt RPM-GPG-KEY.atomicorp.txt
yum -y install libxml2* curl curl-devel libjpeg* libpng* freetype-devel
yum -y install mysql mysql-server mysql-devel
service mysqld restart
wget http://cn2.php.net/distributions/php-5.6.2.tar.gz
tar -xvf php-5.6.2.tar.gz
cd php-5.6.2
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl --enable-bcmath --enable-sockets
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /root/php-5.6.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd -
rm -rf php-5.6.2 php-5.6.2.tar.gz
yum install -y nginx
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
echo "user nginx nginx;
worker_processes 16;
error_log /var/log/nginx_error.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
log_format www '$"remote_addr" - $"remote_user" [$"time_local"] \"\$request\" '
'$"status" $"body_bytes_sent" \"\$http_referer\" '
'\"\$http_user_agent\" $"http_x_forwarded_for"';
server
{
listen 80;
server_name vagrant-centos65.vagrantup.com;
index start.php index.htm index.html index.php pengyou.php weibo.php qzone.php;
root /usr/share/nginx/html;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index start.php;
include fastcgi.conf;
}
location ~ .*.(svn|git|cvs)
{
deny all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
}" > /etc/nginx/nginx.conf
sed -i 's/user =.*/user = nginx/g' /usr/local/php/etc/php-fpm.conf
sed -i 's/group =.*/group = nginx/g' /usr/local/php/etc/php-fpm.conf
/etc/init.d/php-fpm start
/etc/init.d/nginx start
echo "<?php
phpinfo();
?>
" > /usr/share/nginx/html/cc.php
mysql -uroot <<EOF
create database wiki charset utf8;
grant all on wiki.* to wiki@'localhost' identified by 'wiki';
flush privileges;
EOF
wget -c http://kaiyuan.hudong.com/download.php?n=HDWiki-v6.0UTF8-20170209.zip -O HDWiki-v6.0UTF8-20170209.zip
unzip HDWiki-v6.0UTF8-20170209.zip
mv hdwiki/* /usr/share/nginx/html/
rm -rf HDWiki-v6.0UTF8-20170209.zip document hdwiki
cd /usr/share/nginx/html/
chmod 0777 ./uploads ./uploads/userface ./data ./plugins ./style/default/logo.gif ./config.php
cd -
exit
打开浏览器,centos的ip地址,进行设置,就可以了!
默认localhost那里改成127.0.0.1
mysql账户:root
mysql密码为空
别的默认!