1. mysql : sudo apt-get install mysql-server mysql-client
    nginx:
  1. sudo apt-get install nginx

    安装Nginx稳定版本
  1. sudo apt-get install python-software-properties
  2.  
  3. sudo add-apt-repository ppa:nginx/stable
  4.  
  5. sudo apt-get update
  6.  
  7. sudo apt-get install nginx

    启动
  1. sudo service nginx start

    安装PHP

  1. sudo apt-get install php5-fpm
      php测试页
  1. sudo vi /usr/share/nginx/html/info.php
  1. <?php
    phpinfo();
    ?>

    修改nginx的配置

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
#网站根目录
root /usr/share/nginx/html;
#增加index.php
index index.php index.html index.htm;

# Make site accessible from http://localhost/
#绑定域名
server_name localhost;

location / {

try_files $uri $uri/ =404;

}

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}

#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {

# With php5-fpm:
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

  

  1. proxy_conf
  2.  
  3. proxy_redirect off;
  4. proxy_set_header Host $host;
  5. proxy_set_header X-Real-IP $remote_addr;
  6. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  7. client_max_body_size 10m;
  8. client_body_buffer_size 128k;
  9. proxy_connect_timeout 90;
  10. proxy_send_timeout 90;
  11. proxy_read_timeout 90;
  12. proxy_buffers 32 4k;

  

  1. fastcgi_conf
  2.  
  3. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  4. fastcgi_param QUERY_STRING $query_string;
  5. fastcgi_param REQUEST_METHOD $request_method;
  6. fastcgi_param CONTENT_TYPE $content_type;
  7. fastcgi_param CONTENT_LENGTH $content_length;
  8. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  9. fastcgi_param REQUEST_URI $request_uri;
  10. fastcgi_param DOCUMENT_URI $document_uri;
  11. fastcgi_param DOCUMENT_ROOT $document_root;
  12. fastcgi_param SERVER_PROTOCOL $server_protocol;
  13. fastcgi_param GATEWAY_INTERFACE CGI/1.1;
  14. fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
  15. fastcgi_param REMOTE_ADDR $remote_addr;
  16. fastcgi_param REMOTE_PORT $remote_port;
  17. fastcgi_param SERVER_ADDR $server_addr;
  18. fastcgi_param SERVER_PORT $server_port;
  19. fastcgi_param SERVER_NAME $server_name;
  20.  
  21. fastcgi_index index.php;
  22.  
  23. fastcgi_param REDIRECT_STATUS 200;

  

  1. mime_types
  2.  
  3. types {
  4. text/html html htm shtml;
  5. text/css css;
  6. text/xml xml rss;
  7. image/gif gif;
  8. image/jpeg jpeg jpg;
  9. application/x-javascript js;
  10. text/plain txt;
  11. text/x-component htc;
  12. text/mathml mml;
  13. image/png png;
  14. image/x-icon ico;
  15. image/x-jng jng;
  16. image/vnd.wap.wbmp wbmp;
  17. application/java-archive jar war ear;
  18. application/mac-binhex40 hqx;
  19. application/pdf pdf;
  20. application/x-cocoa cco;
  21. application/x-java-archive-diff jardiff;
  22. application/x-java-jnlp-file jnlp;
  23. application/x-makeself run;
  24. application/x-perl pl pm;
  25. application/x-pilot prc pdb;
  26. application/x-rar-compressed rar;
  27. application/x-redhat-package-manager rpm;
  28. application/x-sea sea;
  29. application/x-shockwave-flash swf;
  30. application/x-stuffit sit;
  31. application/x-tcl tcl tk;
  32. application/x-x509-ca-cert der pem crt;
  33. application/x-xpinstall xpi;
  34. application/zip zip;
  35. application/octet-stream deb;
  36. application/octet-stream bin exe dll;
  37. application/octet-stream dmg;
  38. application/octet-stream eot;
  39. application/octet-stream iso img;
  40. application/octet-stream msi msp msm;
  41. audio/mpeg mp3;
  42. audio/x-realaudio ra;
  43. video/mpeg mpeg mpg;
  44. video/quicktime mov;
  45. video/x-flv flv;
  46. video/x-msvideo avi;
  47. video/x-ms-wmv wmv;
  48. video/x-ms-asf asx asf;
  49. video/x-mng mng;
  50. }

  



  1. 修改默认站点
  1. sudo vi /etc/nginx/sites-available/default 在这里您可以定义根目录,你的网站域名,以及其他设置
    下面是例子
  1. server {
  2. listen 80 default_server;
  3. listen [::]:80 default_server ipv6only=on;
  4.  
  5. root /usr/share/nginx/html;
  6. index index.php index.html index.htm;
  7.  
  8. # Make site accessible from http://localhost/
  9. server_name localhost;
  10.  
  11. location / {
  12.  
  13. try_files $uri $uri/ /index.php;
  14.  
  15. }
  16.  
  17. location /doc/ {
  18. alias /usr/share/doc/;
  19. autoindex on;
  20. allow 127.0.0.1;
  21. allow ::1;
  22. deny all;
  23. }
  24.  
  25. #
  26. error_page 500 502 503 504 /50x.html;
  27. location = /50x.html {
  28. root /usr/share/nginx/html;
  29. }
  30.  
  31. location ~ \.php$ {
  32.  
  33. # With php5-fpm:
  34. try_files $uri =404;
  35. fastcgi_pass unix:/var/run/php5-fpm.sock;
  36. fastcgi_index index.php;
  37. include fastcgi_params;
  38. }
  39.  
  40. # deny access to .htaccess files, if Apache's document root
  41. # concurs with nginx's one
  42. #
  43. location ~ /\.ht {
  44. deny all;
  45. }
  46. }

 修改完以后 重启

  1. sudo service nginx reload

    安装Xcache,一个自由和开放的PHP操作码缓存和优化PHP中间代码隐藏自己,以及其他PHP模块:
  1. sudo 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 php5-xcache

  1. sudo service php5-fpm restart重启

 



  1.  




ubuntu下安装nginx -php的更多相关文章

  1. Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL

    .简介: Tomcat在高并发环境下处理动态请求时性能很低,而在处理静态页面更加脆弱.虽然Tomcat的最新版本支持epoll,但是通过Nginx来处理静态页面要比通过Tomcat处理在性能方面好很多 ...

  2. 转- 在ubuntu下安装Nginx

    一. 安装包安装 1.1 安装Nginx $sudo apt-get install nginx Ubuntu安装之后的文件结构大致为: 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经 ...

  3. ubuntu下安装 nginx + php + memcached + mariadb

    一,apt-get 安装 1,安装nginx sudo apt-get install nginx 所有的配置文件都在/etc/nginx下,虚拟主机配置在/etc/nginx/sites-avail ...

  4. Ubuntu下安装Nginx

    转载自:http://www.cnblogs.com/skynet/p/4146083.html 1.Nginx安装 我使用的环境是64位 Ubuntu 14.04, Nginx是Nginx 1.10 ...

  5. Ubuntu下安装Nginx详细步骤

    Nginx安装之前需要三个支持: 模块依赖性 ①gzip 模块需要 zlib 库 ②rewrite 模块需要 pcre 库 ③ssl 功能需要 openssl 库 预先编译好的包: sudo apt- ...

  6. Ubuntu下安装nginx及使用

    首先介绍以下nginx.下图来自百科介绍:详细介绍地址:https://baike.baidu.com/item/nginx/3817705?fr=aladdin 在我们平时的开发娱乐中,也许并不会涉 ...

  7. ubuntu 下安装nginx

    y@y:~$ sudo apt-get install nginx y@y:~$ sudo service nginx start y@y:~$ nginx默认使用80端口,打开浏览器输入:http: ...

  8. Ubuntu下安装与卸载Nginx

    1.Ubuntu下安装Nginx比较简单 敲入下列命令即可: sudo apt-get update sudo apt-get install nginx 2.Ubuntu下卸载,稍不注意就会入坑 s ...

  9. Ubuntu下安装LNMP之php7的安装并配置Nginx支持php及卸载php

    据了解,php7是比之前的版本性能快很多的.http://php.net/get/php-7.2.2.tar.gz/from/a/mirror 安装前也可提前将相关依赖库安装好,或者在安装php时若安 ...

随机推荐

  1. 设备通讯——RS232

    RS232的接口有两种--一种公头.一种母头,两种头的引脚是有区别的 MAX232电路图: 注意:串口通讯需要交叉接线.

  2. Apache Jmeter 性能测试

    今天在写性能测试报告的时候需要使用到数据,打算用做一下性能测试,然后在百度后发现了一款Apache开源的Jmeter压测工具 Jmeter概述: Apache JMeter是一款纯java编写负载功能 ...

  3. 多测师讲解rf _基本使用002_高级讲师肖sir

      在你安装好RF-ride之后,桌面就会生成一个RIDE图标.双击启动,界面如下:  

  4. 多测师讲解python _函数中变量_高级讲师肖sir

    定义的函数内部的变量名如果是第一次出现, 且在=符号前,那么就可以认为是 被定义为局部变量.在这种情况下,不论全局变量中是否用到该变量名,函数中 使用的都是局部变量.例如: num=100 #全局变量 ...

  5. canal 整合RabbitMQ

    环境如下: canal: 1.15-alpha-1 mysql  5.6.49 rabbitmq 3.7.14 Erlang 21.3 canal 安装和启动 见上篇文章 canal快速安装启动 但是 ...

  6. 用Hugo在gitee上构建博客(Windows环境下)

    目录 用Hugo在gitee上构建博客(Windows环境下) 1.为什么要用gitee? 2.安装git 3.安装Hugo 4.创建远程仓库 5.搭建博客 (以下所有命令都在git bash中输入) ...

  7. UI设计学习总结

    UI设计学习总结 平面设计基础 平面构成 三大构成:点线面 重复构成 相同,有规律的重复 近似构成 形状,大小,色彩,肌理相似 渐变构成 色彩逐渐变化 发射构成 通过一点向四周扩散犹如绽放的花朵 密集 ...

  8. Linux系统安装Redis(2020最新最详细)

    2020最新Linux系统发行版ContOS7演示安装Redis 为防止操作权限不足,建议切换root用户,当然如果你对Linux命令熟悉,能够自主完成权限更新操作,可以不考虑此推荐. 更多命令学习推 ...

  9. Linux入门到放弃之二《目录处理常用命令的使用方法》

    一,目录操作命令 1.用pwd命令查看当前所在的目录: 2.用ls命令列出此目录下的文件和目录: 3.列出此目录下包括隐藏文件在内的所有文件和目录并且长格式显示: (  -l表示长格式,-a表示隐藏文 ...

  10. oracle强制修改字符集

    首先查看服务端字符集 select * from v$nls_parameters where parameter = 'NLS_CHARACTERSET' NLS_CHARACTERSET WE8M ...