ubuntu14.04 + nginx+mysql+php

mysql:

sudo apt-get install mysql-server mysql-client​

安装过程中会二次提示输入密码,这个是设置mysql中root的密码。​

nginx:

1) sudo apt-get install nginx​

这样装上的版本是14.01库中版本比较老。

2)sudo add-apt-repository ppa:nginx/stable

sudo apt-get updatesudo

sudo apt-get install nginx

这样目前装上的是1.6版nginx

php:

sudo apt-get install php5-fpm

守护进程的方式安装PHP5

phpmyadmin:

sudo apt-get install phpmyadmin

安装过程中会提示输入mysql的密码。


mark:

1) nginx 1.6的默认web主目录在​/var/www目录,通过修改nginx的配置文件可以更改默认目录。/etc/nginx/sites-available/default文件

​修改 root /var/www 这行为自己使用的www目录

​修改主机名:server_name localhost;

修改重定向到index.php文件 :

location / {

               # First attempt to serve request as file,then               

               # as directory, then fall back to displaying a404.              

               try_files $uri $uri/ =404;

              if (!-e $request_filename){

                  rewrite ^(.*)$ /index.php?$1 last;

                    

}

把这行的注释去掉,使用FPM守护进程运行PHP

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

我的defaul​t

##
# You should look at the following URL's in order to grasp a solidunderstanding
# of Nginx configuration files in order to fully unleash the powerof Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and startwith a clean
# file but keep this around for reference. Or just disable insites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailedexamples.
##

# Default server configuration
#
server {
    listen 80default_server;
    listen[::]:80 default_server;

    # SSLconfiguration
    #
    # listen 443ssl default_server;
    # listen[::]:443 ssl default_server;
    #
    # Selfsigned certs generated by the ssl-cert package
    # Don't usethem in a production server!
    #
    # includesnippets/snakeoil.conf;

    root/home/maxim/www/0550cn/public;

    # Addindex.php to the list if you are using PHP
    indexindex.php index.html index.htm index.nginx-debian.html;

    server_namelocalhost;

    location /{
       # Firstattempt to serve request as file, then
       # asdirectory, then fall back to displaying a 404.
       try_files$uri $uri/ =404;
      
       if (!-e$request_filename){
                   rewrite^(.*)$ /index.php?$1 last;
               }
      

    }

    # pass thePHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~\.php$ {
   #    includesnippets/fastcgi-php.conf;
    #
   #    # Withphp5-cgi alone:
   #   fastcgi_pass 127.0.0.1:9000;
   #    # Withphp5-fpm:
   #   fastcgi_pass unix:/var/run/php5-fpm.sock;
    #}

    location ~\.php$ {
              include snippets/fastcgi-php.conf;
       
              # With php5-cgi alone:
              #fastcgi_pass 127.0.0.1:9000;
              # With php5-fpm:
              fastcgi_pass unix:/var/run/php5-fpm.sock;
       }



    # denyaccess to .htaccess files, if Apache's document root
    # concurswith nginx's one
    #
    #location ~/\.ht {
   #    denyall;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ andsymlink that
# to sites-enabled/ to enable it.
#
#server {
#    listen80;
#    listen[::]:80;
#
#    server_nameexample.com;
#
#    root/var/www/example.com;
#    indexindex.html;
#
#    location /{
#       try_files$uri $uri/ =404;
#    }
#}



2)php.ini位置在:/etc/php5/fpm/php.ini

3) phpmyadmin默认安装在 /usr/share/phpmyadmin

可以建个符号连接到web目录

ln -s /usr/share/phpmyadmin/home/maxim/www/phpmyadmin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值