ubuntu 搭建lnmp

前端之家收集整理的这篇文章主要介绍了ubuntu 搭建lnmp前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1,ubuntu - 14.04.1 2,ubuntu 自带PHP版本为5.5.9(建议安装PHP5.6+) 3,Nginx 安装默认 4,MysqL 安装默认 ubuntu 安装PHP5.6 - sudo add-apt-repository ppa:ondrej/PHP - sudo apt-get update - sudo apt-get -y install PHP5.6 PHP5.6-mcrypt PHP5.6-mbstring PHP5.6-curl PHP5.6-cli PHP5.6-MysqL PHP5.6-gd PHP5.6-intl PHP5.6-xsl PHP5.6-zip PHP5.6-fpm PHP5.6-dev PHP5.6-json 安装完成后可以执行PHP -m 查看安装的module ps aux | grep PHP-fpm 安装Nginx:(安装默认) - sudo apt-get install Nginx 安装完成后可以执行Nginx -v 查看版本 ps aux | grep Nginx 安装MysqL:(安装默认) - sudo apt-get install MysqL-server MysqL-client 会提示你输入root用户的密码: 输入设置的密码后,选中确定,安装完成 安装完成后可以执行:MysqL -u root -p 密码 进入成功后显示MysqL信息 配置Nginx配置文件:(/etc/Nginx/conf) 新建配置文件 default.conf 内容如下: server { listen 80; server_name www.test.com; root /home/yangshudong/xiaomi/test; index index.PHP index.html index.htm; error_page 404 405 /error/404.html; error_page 500 502 503 504 /error/50x.html; location / { try_files $uri $uri/ /index.PHP$is_args$args; } location ~ \.PHP($|/) { include fastcgi_params; fastcgi_pass unix:/var/run/PHP/PHP5.6-fpm.sock; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { access_log off; expires 340d; } location ~ .*\.(js|css)?$ { access_log off; expires 2d; } access_log /home/work/logs/Nginx/default.log; } 或者修改Nginx 配置文件:(/etc/Nginx/sites-enabled) server { listen 80; server_name www.test.com; root /home/yangshudong/xiaomi/test; index index.PHP index.html index.htm; location / { try_files $uri $uri/ =404; } location ~ \.PHP($|/) { fastcgi_split_path_info ^(.+\.PHP)(/.+)$; fastcgi_pass unix:/var/run/PHP/PHP5.6-fpm.sock; fastcgi_index index.PHP; include fastcgi_params; } } 操作命令:(service启动) sudo service Nginx start/stop/restart sudo Nginx -t 测试Nginx sudo Nginx -s reload 平滑启动Nginx sudo service PHP5.6-fpm start/stop/restart sudo service MysqLd start/stop/restart 可执行文件:(脚本启动) sudo /etc/init.d/PHP5.6-fpm start (启动PHP) sudo /etc/init.d/Nginx start (启动Nginx) sudo /etc/init.d/MysqL start (启动MysqL)

猜你在找的Ubuntu相关文章