❝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.
❞
This article mainly focuses on the following points Introduction to each aspect
Install composer Install laravel Configure php-fpm to start automatically Configure nginx to start automatically
Implementation environment of this article
centos 7.3 All operations are performed in virtual machine simulation
1. Install composer
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
## 2. Install laravel
Be sure to pay attention to the requirements for PHP for the version you need to install.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.
composer 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
3. Access test
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 machine
http://192.168.254.135/blog/public/index.php
##4. Fault Tolerance
This content will not affect local operations, nor will it affect online servers. It uses the same environment as Kaka. Since it is a virtual machine, php-fpm may not restart after shutting down and starting up, and the following error will appear.Don’t panic when you encounter this error, take a look Is your php-fpm enabled?
systemctl start php-fpm
5. Set fpm to start automatically
PHP is installed directly using yumTo set fpm to start automatically, you only need to executesystemctl enable php-fpm
6. Set nginx to start automatically
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!

Laravel stands out by simplifying the web development process and delivering powerful features. Its advantages include: 1) concise syntax and powerful ORM system, 2) efficient routing and authentication system, 3) rich third-party library support, allowing developers to focus on writing elegant code and improve development efficiency.

Laravelispredominantlyabackendframework,designedforserver-sidelogic,databasemanagement,andAPIdevelopment,thoughitalsosupportsfrontenddevelopmentwithBladetemplates.

Laravel and Python have their own advantages and disadvantages in terms of performance and scalability. Laravel improves performance through asynchronous processing and queueing systems, but due to PHP limitations, there may be bottlenecks when high concurrency is present; Python performs well with the asynchronous framework and a powerful library ecosystem, but is affected by GIL in a multi-threaded environment.

Laravel is suitable for projects that teams are familiar with PHP and require rich features, while Python frameworks depend on project requirements. 1.Laravel provides elegant syntax and rich features, suitable for projects that require rapid development and flexibility. 2. Django is suitable for complex applications because of its "battery inclusion" concept. 3.Flask is suitable for fast prototypes and small projects, providing great flexibility.

Laravel can be used for front-end development. 1) Use the Blade template engine to generate HTML. 2) Integrate Vite to manage front-end resources. 3) Build SPA, PWA or static website. 4) Combine routing, middleware and EloquentORM to create a complete web application.

PHP and Laravel can be used to build efficient server-side applications. 1.PHP is an open source scripting language suitable for web development. 2.Laravel provides routing, controller, EloquentORM, Blade template engine and other functions to simplify development. 3. Improve application performance and security through caching, code optimization and security measures. 4. Test and deployment strategies to ensure stable operation of applications.

Laravel and Python have their own advantages and disadvantages in terms of learning curve and ease of use. Laravel is suitable for rapid development of web applications. The learning curve is relatively flat, but it takes time to master advanced functions. Python's grammar is concise and the learning curve is flat, but dynamic type systems need to be cautious.

Laravel's advantages in back-end development include: 1) elegant syntax and EloquentORM simplify the development process; 2) rich ecosystem and active community support; 3) improved development efficiency and code quality. Laravel's design allows developers to develop more efficiently and improve code quality through its powerful features and tools.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.