美文网首页
阿里云上Ubuntu 14.0 环境下搭建lnmp

阿里云上Ubuntu 14.0 环境下搭建lnmp

作者: 那记忆里的事 | 来源:发表于2017-04-06 21:55 被阅读0次

1. 更新软件源,新装的系统需要使用一下这个命令

   sudo apt-get update 

2.安装nginx

sudo apt-get install nginx

3. 安装php5-fpm

sudo apt-get install php5-fpm

4. vim  /etc/php5/fpm/pool.d/www.conf 看看里面

Listen监听的是什么 结合nginx配置文件fastcgi_pass修改 (如可能的值 /var/run/php5-fpm.sock,如果一样就不需要修改)

在配置文件http那里加上

server {

listen       80;

server_name  你的域名;

root  "/var/www/web";

location / {

index  index.html index.htm index.php;

#autoindex  on;

if ( !-e $request_filename ){

rewrite (.*)$/index.php/$fastcgi_path_info;

}

}

location ~ \.php(.*)$ {

fastcgi_pass   unix:/var/run/php5-fpm.sock;

fastcgi_index  index.php;

fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

fastcgi_param  PATH_INFO $fastcgi_path_info;

fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;

include        fastcgi_params;

}

}

5. 重启php-fpm 和nginx

/etc/init.d/php5-fpmrestart

nginx –s reload

因为数据库使用的是阿里云rds,此处就不转mysql了

相关文章

网友评论

      本文标题:阿里云上Ubuntu 14.0 环境下搭建lnmp

      本文链接:https://www.haomeiwen.com/subject/zvqcattx.html