apt-get更新
$ sudo apt-get update
$ sudo apt-get upgrade
安装nginx
$ sudo apt-get install nginx
测试:访问IP
配置文件:/etc/ngingx/conf
安装MYSQL
$ sudo apt-get install mysql-server php5-mysql
设置可其它ip登录
/etc/mysql/my.conf
bind-ip注释
$ mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
安装PHP
$ sudo apt-get install php5-fpm
$ sudo apt-get install php5-redis
$ sudo apt-get install php5-gd
$ sudo vi /etc/php5/fpm/php.ini
cgi.fix_pathinfo=0
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
date.timezone = 'PRC'
$ sudo service php5-fpm restart
配置Nginx
/etc/nginx/sites-available/default
sudo vi /etc/nginx/sites-available/default
thinkphp5的配置:
server {
charset utf-8;
client_max_body_size 128M;
listen 80;
server_name localhost;
root /var/www/cardada/public/;
index index.php;
location / {
# Redirect everything that isn't a real file to index.php
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
error_page 404 /404.html;
location ~ /\.(ht|svn|git) {
deny all;
}
Redis
配置reids可后台运行 /etc/redis/redis.conf
daemonize yes
$ service redis-server /etc/redis/redis.conf
备注:
整个过程当中遇到一些问题,都是查看log日志或者是参考别人的博客进行的,程序员道路第一篇博客。