iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🎱

Notes on running nginx + PHP on CentOS Stream 8

に公開

This is a note. It starts from where CentOS Stream 8 was installed as a Server (with GUI).

Installing nginx

Install from the installation media. It is easy because the media is automatically mounted when using a GUI.

Installing nginx
# rpm -i nginx-1.20.0-3.module_el8.6.0+927+27be7f27.x86_64.rpm \
	nginx-filesystem-1.20.0-3.module_el8.6.0+927+27be7f27.noarch.rpm \
	centos-logos-httpd-85.8-1.el8.noarch.rpm

You can start it in its default state.

Starting nginx
# systemctl start nginx

You might want to check the display in a browser to see if it's running.

Installing PHP

Use php-fpm.

Installing php-fpm
# rpm -i php-fpm-7.4.19-1.module_el8.5.0+815+1c4fd2e5.x86_64.rpm \
	httpd-filesystem-2.4.37-40.module_el8.5.0+852+0aafc63b.noarch.rpm \
	php-common-7.4.19-1.module_el8.5.0+815+1c4fd2e5.x86_64.rpm

Since the configuration files are installed along with it, the settings will be loaded simply by starting php-fpm and restarting nginx.

Starting php-fpm and restarting nginx
# systemctl start php-fpm
# systemctl restart nginx

To verify that it's working, it's a good idea to create a simple PHP file and check it.

Creating a simple PHP file
# ed /usr/share/nginx/http/info.php
a
<?php phpinfo();
.
wq


Conclusion

That's all.

Discussion