欢迎光临
我们一直在努力

Ubuntu Laravel install

1.Nginx install

# apt-get update
# apt install -y nginx
# service nginx start

2.Mysql install

# apt-get install -y mysql-server php7.4-mysql
# service mysql start

3. PHP install

# apt-get -y install  php7.4 php7.4-fpm php7.4-mysql php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-intl php7.4-gd php7.4-zip
# service php7.4-fpm start

4.composer install

#apt-get install composer

5.Laravel install

# cd ~
# mkdir laravel 
# cd laravel
# composer global require "laravel/installer"
# laravel new blog

6. Create-project

composer create-project --prefer-dist laravel/laravel blog

7. start laravel use php srtisan

php artisan serve

8. nginx config

# vim /etc/nginx/sites-enabled/dev.conf
server {
        listen       80;
        server_name  test.laravel.domain;
        root ${HOME}/laravel/blog/public;

        charset utf-8;
        index index.php;

        access_log  /var/log/laravel.domain.log;
        add_header Access-Control-Allow-Origin *;

        location / {
                try_files $uri $uri/ /index.php?$uri&$args;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root   html;
        }
        location ~ \.php$ {
                fastcgi_pass   unix:/run/php/php7.4-fpm.sock;
                fastcgi_index  index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|woff2)$
        {
                expires      30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires      12h;
        }
}
赞(0)
未经允许不得转载:自游互动 » Ubuntu Laravel install
分享到: 更多 (0)

相关推荐

  • 暂无文章

自由技术,自由自在

项目合作联系我们