Home > Article > PHP Framework > laravel installation and php-fpm, nginx configuration self-starting
❝I have always used TP for my work. This time when I was building RabbitMQ, I thought of using larave to build it. During the building process, php-fpm and nginx were configured to start automatically. Extending from one installation of laravel to other points, this article will bring you a different experience.
❞
Execute the commandcurl -sS https://getcomposer.org/installer | php After
you can see the picture below
Move php composer.phar
to the bin directory mv composer.phar /usr/local/bin/composer
and rename it to composer
Why should we put this in the usr/local/bin directory? Only in this way can we use composer globally
Enter the command to check the version and see if the installation is successful. Here you can see that the version we installed is 1.10, which proves that we have successfully installed composer
Kaka uses PHP7.2 hereLaravel is prepared to operate in a virtual machine, so there is no separate configuration of conf, and it is operated directly in the html directory.
Execute installationcomposer create-project --prefer-dist laravel/laravel blog "5.8.*"Check the laravle version, here Kaka installed laravel5.8 PHP The environment requires 7.2. There is no need to upgrade PHP, so there is no need to choose a higher version of laravel
Use ifconfig to find out the IP address of my virtual machine.
Comrades who use virtual machines, when there is no fixed IP assigned to the virtual machine, check the IP address of the virtual machine every time when connecting to xsheel or ftp. This IP address may change after the virtual machine is shut down and turned on. There have been changesThen you can access it through the host machinehttp://192.168.254.135/blog/public/index.php
Don’t panic when you encounter this error, take a look Is your php-fpm enabled?
Execute the commandsystemctl start php-fpm
systemctl enable php-fpm
Adjust according to your own nginx installation location, my installation location is /usr/local/nginx/
Executecd /lib/systemd/system/
Createvim nginx.service
and write As follows
[Unit] Description=nginx service After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
Set up auto-start at bootsystemctl enable nginx
The above is the detailed content of laravel installation and php-fpm, nginx configuration self-starting. For more information, please follow other related articles on the PHP Chinese website!