Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up nginx+php server application under Linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to set up nginx+php server application under Linux system". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to set up nginx+php server application under Linux system" can help you solve the problem.

Similar to installing other software, the installation process is basically stupid.

Install nginx, execute the following command, and finish quickly

Sudo apt-get install nginx

The default installation location for configuration files is:

Conf: / etc/nginx/nginx.conf

Bin:/usr/sbin/nginx

Vhost: / etc/nginx/sites-enable/default

Cgi-params: / etc/nginx/fastcgi-params

Install the php-cgi module

Sudo apt-get install php5-cgi

The default installation location for configuration files is:

Php-cgi: / usr/bin/php-cgi

Php5-cgi: / usr/bin/php5-cgi

Cgi config: / usr/bin/cgi/php.ini

One thing to note here is that you must change the cgi.fix_pathinfo data of the php.ini file to 1, and the default is 0 cgi.fix_pathinfo=1; so that php-cgi can use the script_filename variable properly.

Install spawn-fcgi

If the system does not have the gcc compilation environment installed, just need to install the build-essential toolkit before installing lighttpd, execute the following command:

Sudo apt-get install build-essential

Wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz

Tar-xvf lighttpd-1.4.19.tar.gz

Cd lighttpd-1.4.19/

Sudo apt-get install libpcre3-dev

. / configure-without-zlib-without-bzip2

Make

Sudo cp src/spawn-fcgi / usr/local/bin/spawn-fcgi

Start fast_cgi:

Spawn-fcgi-a 127.0.0.1-p 9000-c 5-u www-data-g www-data-f / usr/bin/php-cgi

Start nginx

Sudo / etc/init.d/nginx start

This is the end of the introduction on "how to set up nginx+php server applications under the Linux system". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report