当前位置:首页 > 电脑常识 > 正文

ubuntu安置配置LNMP 8090安适门户

11-20 电脑常识

Ubuntu-15. 04安置配置LNMP处事
一、操纵系统版本信息
root@zabbix-server:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty

二、安置MYSQL
(1)开始安置:
apt-get install mysql-server libmysqld-dev

(2)提示设置MySQL root用户名暗码(root/bdyun)

(3)确认root用户暗码

(4)MySQL版本
root@zabbix-server:~# mysql -V
mysqlVer 14.14 Distrib 5.5.50, for debian-linux-gnu (x86_64) using readline 6.3
三、安置Nginx
(1)安置:
apt-get install nginx

(2)启动处事
# service nginx start
或者
# /etc/init.d/nginx start

(3)Web测试是否告成安置,*.*/(主机地点)跳出Welcome to nginx!说明配置告成

四、安置PHP5
(1)开始安置
apt-get install php5-fpm php5-mysql

(2)配置nginx.conf
配置前作备份
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
配置/etc/nginx/nginx.conf
vi /etc/nginx/nginx.conf搜索文字worker_processes找到worker_processes auto;改为worker_processes 4;搜索文字keepalive_timeout找到keepalive_timeout 65;改为keepalive_timeout 2;

(3)配置Nginx让其使用php-fpm进程
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bakvi /etc/nginx/sites-available/default

这里改削如下


或者直接复制替换
server {listen 80 default_server;listen [::]:80 default_server ipv6only=on;root /usr/share/nginx/html;index index.php index.html index.htm;server_name server_domain_name_or_IP;location / {try_files $uri $uri/ =404;}error_page 404 /404.html;error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}location ~ \.php$ {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;}}
 
(4)从头加载nginx
service nginx reload

(5)配置PHP,改削php.ini文件
vi /etc/php5/fpm/php.ini设置,打消分号;将1改为0cgi.fix_pathinfo=0:

(6)从头加载 PHP-FPM:
service php5-fpm reload

五、测试运行

测试PHP
创建探针文件info.php到/usr/share/nginx/html目录下
vi /usr/share/nginx/html/info.phpphpinfo();?>

浏览器访谒探针文件*.*/info.php
如果呈现PHP版本信息说明配置告成

(2)测试mysql创建测试文件sqltest.php到/usr/share/nginx/html目录下
vi /usr/share/nginx/html/sqltest.php
$link=mysql_connect("localhost","root","ubuntu");
if(!$link) echo "FAILD!";
else echo "OK!";
?>

访谒*.*sqltest.php
如果呈现OK字符说明mysql配置告成

其实,这台处事器我是为zabbix监控筹备的,有兴趣的伴侣可以看一下我的下一篇文章《Ubuntu系统LNMP环境下安置配置zabbix3.0》

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/file/pc/12783.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 1378074访问次数
  • 建站天数
  •