Home > Backend Development > PHP Tutorial > Building a common server environment for Ubuntu - Nginx+PHP

Building a common server environment for Ubuntu - Nginx+PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 08:55:39
Original
1398 people have browsed it

1. Install Nginx

<code>apt-<span>get</span> install nginx</code>
Copy after login

2. Start Nginx

<code>service nginx <span><span>start</span></span></code>
Copy after login

3. Access the server IP
If you see "Welcome to nginx!", it means the installation is complete.
4. Install PHP

<code>apt<span>-get</span> install php5<span>-fpm</span></code>
Copy after login

5. Configure Nginx

<code><span>vi</span> /etc/nginx/sites-available/<span><span>default</span></span></code>
Copy after login

Find the following code and remove the corresponding comments

<code>location ~ \.php$ {
        <span><span>include</span> snippets/fastcgi-php.conf;</span>
        fastcgi_pass unix:/<span>var</span>/run/php5-fpm.sock;
}</code>
Copy after login

Restart the service

<code>service nginx restart</code>
Copy after login

6. The default website root directory is /var/www/html

<code>vi /<span>var</span>/www/html/test.php</code>
Copy after login

Enter the following content, And save

<code><span><span><?php</span><span>echo</span> phpinfo();
<span>?></span></span></code>
Copy after login

Visit the website IP/test.php. If you can see the phpinfo information, it means that the php installation is successful.

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the common server environment construction of Ubuntu - Nginx+PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template