lnmp环境搭建

软件源设置:
添加特殊软件源:
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo add-apt-repository ppa:chris-lea/node.js

更新软件源:

sudo apt-get update

软件安装:
Base:

sudo apt-get install -y git qgit vim
sudo apt-get install -y nginx
sudo apt-get install -y mysql-server mysql-client
sudo apt-get install -y redis-server
sudo apt-get install -y flex curl tig ffmpeg xpdf make gcc
sudo apt-get install -y libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 libjpeg-dev libgif-dev libfreetype6-dev ttf-wqy-microhei ttf-wqy-zenhei g++
sudo apt-get install -y php5 php5-xdebug php5-gd php5-curl php5-mysql php5-fpm php-pear php5-dev php5-json
sudo apt-get install -y nodejs python-setuptools
sudo npm install -g resource_build
sudo pecl install redis

Composer:

cd ~/
mkdir bin
curl -s https://getcomposer.org/installer | php -- --install-dir=$HOME/bin
chmod +x bin/composer.phar
sudo gedit /etc/profile

PATH="$PATH:$HOME/bin"
export PATH

Zsh:

sudo apt-get install -y zsh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
sudo chsh -s /bin/zsh

Swftools:

wget http://www.swftools.org/swftools-2013-04-09-1007.tar.gz
tar -zvxf swftools-2013-04-09-1007.tar.gz
cd swftools-2013-04-09-1007
sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure
sudo make
sudo make install

代码(此处假设您的代码根目录为:~/workspace/):

mkdir ~/workspace
cd ~/workspace/
git clone [email protected]:breestealth/SAAS.git
cd ~/workspace/SAAS
chmod 777 -R log
mkdir upload
chmod 777 -R upload
composer.phar install

配置:
PHP:

sudo gedit /etc/php5/mods-available/redis.ini

[redis]
extension=redis.so

sudo ln -s /etc/php5/mods-available/redis.ini /etc/php5/cli/conf.d/
sudo gedit /etc/php5/fpm/php.ini

error_reporting = E_ALL
display_errors = On
html_errors = On
date.timezone = Asia/Shanghai

sudo gedit /etc/php5/fpm/pool.d/www.conf

listen = 127.0.0.1:9000

sudo /etc/init.d/php5-fpm restart

Mysql:

sudo gedit /etc/mysql/my.cnf

在mysqld节点下添加

lower_case_table_names = 1

Nginx:

sudo gedit /etc/nginx/sites-available/www.yourname.aysaas.com

server {
server_name www.yourname.aysaas.com;

root /home/yourname/workspace/saas/public;

error_log /var/log/nginx/www.yourname.aysaas.com-error.log error;

access_log /var/log/nginx/www.yourname.aysaas.com-access.log combined;

location /global/svgweb/ {
break;
}

location /global/jquery/extend/uploadify/ {
break;
}

location /global/pdf2swf/ {
break;
}

location /form/render/ueditor/ {
break;
}

location /favicon.ico {
break;
access_log off;
log_not_found off;
}

location / {
rewrite . /index.php;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

server {
server_name static.yourname.aysaas.com;

root /home/yourname/workspace/saas/public;

location / {
access_log off;
}

location ~ .php$ {
deny all;
}

location ~* .(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
}

server {
server_name fileio.yourname.aysaas.com;
root /home/yourname/workspace/saas/public;
client_max_body_size 128m;/jigouxinxi/index
location /crossdomain.xml {
break;
}

location / {
rewrite . /index.php ;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

sudo ln -s /etc/nginx/sites-available/www.yourname.aysaas.com /etc/nginx/sites-enabled/
sudo /etc/init.d/nginx restart

Hosts:

sudo gedit /etc/hosts

127.0.0.1 www.yourname.aysaas.com
127.0.0.1 static.yourname.aysaas.com
127.0.0.1 fileio.yourname.aysaas.com

你可能感兴趣的:(lnmp环境搭建)