LNMP(tp5)

安装php:
sudo apt install php7.0-mbstring php7.0-gd php7.0-mbstring php7.0-mysql php-redis
安装MariaDB:
$ sudo apt install mariadb-server
启动MariaDB服务:
$ sudo systemctl restart mysql
$ sudo systemctl enable mysql
初始化MariaDB
$ sudo mysql_secure_installation
默认root密码为空;然后设置root密码和其他选项:
- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y
安装ngnix: sudo apt insall ngnix
修改php-fpm的配置文件
vim /etc/php/7.0/fpm/pool.d/www.conf

listen = /tmp/php-fcgi.sock
;listen = /tmp/php-fcgi.sock
listen = 127.0.0.1:9000

修改nginx的配置文件

sudo vim /etc/nginx/sites-enabled/default
 server
{
    listen 80;
    server_name liveknight.xyz;
    index index.php;
    root /var/www/html/dream/public/;

    location / {

    if (!-e $request_filename) {
    rewrite ^/(.*)$ /index.php/$1 last;
    break;
    }
    }

    location ~ \.php {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    set $real_script_name $fastcgi_script_name;
    if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
    set $real_script_name $1;
    set $path_info $2;
    }
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    fastcgi_param SCRIPT_NAME $real_script_name;
    fastcgi_param PATH_INFO $path_info;
    }
} 

报错 403
sudo chmod -R 775 /var/www/html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值