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

Building a common server environment for Ubuntu - Nginx+PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:55:391400browse

1. Install Nginx

<code>apt-<span>get</span> install nginx</code>

2. Start Nginx

<code>service nginx <span><span>start</span></span></code>

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>

5. Configure Nginx

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

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>

Restart the service

<code>service nginx restart</code>

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

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

Enter the following content, And save

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

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.

Statement:
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