zoukankan      html  css  js  c++  java
  • ubuntu上安装nginx+mysql+php5-fpm(PHP5

    题外话:由于近段时间测试环境ssh链路质量不大好,经常短线。故我把整个安装过程放到screen里去执行,以防止断线中断了安装过程。执行screen -S install,这样断线后,只要再执行screen -r install 就可以恢复之前的安装界面。

    1.安装mysql

    sudo apt-get install mysql-server mysql-client
    安装过程中要设置mysql root用户的密码。

    2.安装nginx

    sudo apt-get install nginx

    3.安装成功后。我们重启下nginx服务

    sudo service nginx restart
    启动之后我们就可以访问一下我们的地址了。看能不能出现nginx的欢迎界面。

    4.安装php5-fpm(PHP5 - FastCGI Process Manager)。

    sudo apt-get install php5-fpm

    5.接下来我们要修改一下nginx的站点配置了。

    ngnix的配置文件存放在/etc/nginx/sites-available/default

    server {
    listen 80; ## listen for ipv4; this line is default and implied
    listen [::]:80 default ipv6only=on; ## listen for ipv6
    root /usr/share/nginx/www;
    index index.php index.html index.htm;
    # Make site accessible from http://localhost/
    server_name _;
    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to index.html
    try_files $uri $uri/ /index.html;
    }
    location /doc {
    root /usr/share;
    autoindex on;
    allow 127.0.0.1;
    deny all;
    }
    #error_page 404 /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/www;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ .php$ {
    # proxy_pass http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ .php$ {
    try_files $uri =404;
    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /.ht {
    deny all;
    }
    }
    增加了php解析的一些代码在里面。

    6.我们在安装php5相关的一些组件。

    sudo apt-cache search php5
    apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
    7.重启服务

    sudo service php5-fpm restart
    sudo service nginx
    8.写个探针文件试试吧。呵呵。

    本文系作者原创,转载请注明出处。如您阅读的是转载,请最好再看下原文,原文随时会更新和勘误的。

    @Gordon_chang
    1997年毕业于北京联合大学,先后在中国万网,新媒传信,亚信等公司工作,现在在一家创业型公司担任云计算与大数据运维方面的 PM & Engineer。 专注于以下四个领域: 分布式存储 分布式数据库 云计算 大数据 重点通过技术架构与性能优化(底层)实现基于私有云的大数据平台能力

  • 相关阅读:
    张旭升20162329 2006-2007-2 《Java程序设计》第一周学习总结
    预备作业03——20162329张旭升
    预备作业02 : 体会做中学-20162329 张旭升
    预备作业01——20162329
    FPGA的软核与硬核
    网页调用vlc并播放网络视频
    vue视频插件VLC
    vue+vue-video-player实现弹窗播放视频
    【面向对象程序设计】作业三
    【面向对象程序设计】作业二
  • 原文地址:https://www.cnblogs.com/gordonchang/p/6681708.html
Copyright © 2011-2022 走看看