werew33 发表于 2015-11-4 08:52:19

centos7安装配置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_namelocalhost;

      location / {
            root   /opt/www;
            indexindex.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_indexindex.php;
            fastcgi_paramSCRIPT_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_formatmain'$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.logmain;
    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

页: [1]
查看完整版本: centos7安装配置lnmp