码迷,mamicode.com
首页 > 其他好文 > 详细

centos7安装配置lnmp

时间:2015-11-03 17:58:28      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:lnmp

yum install nginx mariadb-server mariadb php php-mysql php-fpm

systemctl start nginx

systemctl enable nginx

nano /etc/php.ini

cgi.fix_pathinfo=0

nano /etc/php-fpm.d/www.conf

user = nginx 

group = nginx

systemctl start php-fpm

systemctl enable php-fpm

nano /etc/nginx/conf.d/default.conf

    server {

        listen       80;

        server_name  localhost;


        location / {

            root   /opt/www;

            index  index.php index.html index.htm;

        }


        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   /opt/www;

        }

    


        location ~ \.php$ {

            root           /opt/www;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

        }

}

vi nginx.conf

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

events {

    worker_connections 1024;

}

http {

    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘

                      ‘$status $body_bytes_sent "$http_referer" ‘

                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;

    tcp_nopush          on;

    tcp_nodelay         on;

    keepalive_timeout   65;

    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;

    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

}

systemctl restart nginx




systemctl start mariadb

mysql_secure_installation

systemctl enable mariadb.service


centos7安装配置lnmp

标签:lnmp

原文地址:http://guowang327.blog.51cto.com/6513732/1709193

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!