Install Nginx, PHP-FPM, and MySQL on Debian for WordPress

Install Nginx, PHP-FPM, and MySQL on Debian for WordPress

Hi my name is Ryan and in 5 minutes or less
we’re going to get WordPress running on Linux, on a Linux VM on Linode, with Nginx as the
web server. So first we’re going to SSH into our new server. Picked a simple password. And let’s go ahead and run apt-get install
php5-fpm nginx, we’re going to need mysql-server and then we’re also going to need php5-mysql. We’re going to install those dependancies… Then next we’re going to be prompted for the
root password for MySQL. I’m going to use the word password. This is a barebones install we’re doing. I’m
not going to be changing the hostname or setting up the timezone or anything like that. This
is an extremely barebones install of Nginx to get WordPress up and running in as little
time as possible. Alright so now that this install is done,
we’re going to run service nginx start. And if we go to our web browser, we can see that
the website is up now. Next we’re going to create the database. So
if we do mysql, we’re going to log in as the root user given the supplied password, password.
Then we’re going to do create database blog. I’ll just call it blog. And then we’re also going to go to /usr. I
think it’s /usr/share/nginx/www And then we’re going to do wget or we’re going
to download And then we’re going to unzip that. We can delete the zip file we just downloaded. Let’s move everything from the WordPress folder
into this folder. And delete that wordpress file. Let’s also remove index.html that’s that default
Welcome to Nginx file. We’re going to go up a level and I’m going
to change the owner of that www folder to the www-data user. That’s the user that Nginx
and PHP are going to run as. And then I’m going to edit the /etc/nginx/sites-enabled/default
and there’s a few changes we’re going to have to make here. One is the index file. We’ll
just make that .php. Then we’re going to use this tryfiles, We’re going to change that
to php as well. And then if you go down here to, this part
is where the magic happens. This is where Nginx is going to pass off the php files.
So you can disregard this line, it’s 0 by default. You can delete this line too. It’s
if you were setting php5-fpm up to listen on the network. And then we’re going to uncomment
the rest of these here. I’m going to save this file and I’m going to do service nginx
reload. Going to go back over here, refresh, and run
through this config. Database name we chose is blog. Username is
root. Password, localhost, that’s all good. Run the install. Awesome Blog, password, password, and Install
WordPress. Log in. Password. Here we go! We can go to plugins, add new, features. Just
download the first one here. Just to test plugin functionality. If we go to setting we can also make sure
permalinks are functioning properly. Delete the index.php it put in there. Save. Let’s
go to the homepage. It’s going to be cached, let’s just do a refresh. And we can see the permalinks
work just as we had intended. Thanks for watching. I hoped this helped you
out. If you have any questions, let me know!

30 thoughts on “Install Nginx, PHP-FPM, and MySQL on Debian for WordPress

  1. Thank you very much for this video. I have struggled with getting PHP to work, but never thought about looking at the default config 😛

    And, as another one said, you are a FAST typer. Holy crap 😛

  2. sftp should work out of the box as it just uses ssh. There's no additional software to install.

    You should be able to sftp to your box using the same credentials you used to get in via ssh. Let me know if that works for you.

  3. Amazing tutorial. I have a question though. Suppose i want to install wordpress on a domain name. How would i go about that?

  4. hi, iv mede all that you doo in this tutorial, and i have this error when i reload service nginx

    service nginx reload
    Reloading nginx configuration: nginx: [emerg] unexpected end of file, expecting "}" in /etc/nginx/sites-enabled/default:116
    nginx: configuration file /etc/nginx/nginx.conf test failed

  5. i solve, you move very fast and I had not seen you out # from } :))) , now how i import a data base for my wordpress?

  6. without install apache and phpmyadmin ? pls helping me. because your tutorial is the first that i managed to make work wordpress 🙂 ty

  7. i solve this, but i need a to import my database for this wordpress site, how i du that? and addind more virtualweb on the same dedicat host with debian?

  8. yes, but where i upload the file.sql too run that command: mysql -u username -p database_name < file.sql      ?  cane you exemple? pls

  9. I got an error e353: nothing in register. I searched on inet, but it's to difficult for beginner like me. is there any easy way to fix the vi so I can edit my file?

  10. Hello can you make an advanced video on how to install niginx. Like in advanced meaning securely and optimized to make the site better. Thanks!

  11. hi, hru? i waite you to make that tutorial with multi virtual server in nginx ,  from here:

  12. Do have any ideas of doing a Phpmyadmin to this Ryan, I think that will really add value to this awesome tutorial of yours that simply gave all the answers i just needed and in the exact way in needed em, thanks for tat. I hope you could add phpmyadmin, basic nginx vhost config, nginx high traffic config, mysql basic and high traffic config  to this series and it will add value to your awesome series.

  13. Hi Ryan, thanks for sharing this tutorial. I have php-fpm+nginx running but doesn't work correctly with my htaccess file. Can you explain how to set up nginx to work with htaccess files?
    Thanks again.

  14. hi, im back with a problem can you make a tutorial like this for ebian 8 jessie? because now all is change and the old tutorial is not work anymore. ty

  15. My God you're going fast! First time in my life that I had to put the video on a slower speed instead of higher speed!
    Did manage to get it all working though, so thanks for showing me the way.

  16. got aot a Problem here, when i typ the ip adress into the browser, this appears:<?php
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     * @package WordPress
     * Tells WordPress to load the WordPress theme and output it.
     * @var bool
    define('WP_USE_THEMES', true);/** Loads the WordPress Environment and Template */
    require( dirname( _FILE_ ) . '/wp-blog-header.php' );what to do?

  17. This video really helped me set the connection between nginx and php5-fpm! a quick note though, i got stuck into a blank page problem which appears to be relatively popular based on searching online. The solution for me was to include "include fastcgi.conf;" besides "include fastcgi_params;", only the latter of which was mentioned in the video.

    In anycase, really helpful material! Thank you Ryan

  18. This is the type of speed I seek for in training videos. Quick, to the point, address a concern.

    Awesome. Thanks Ryan!

Leave a Reply

Your email address will not be published. Required fields are marked *