0

Being new to nginx and wordpress, I'm trying to install them on an ubuntu 17.10 (on a virtual machine). I've followed this step-by-step guide

https://websiteforstudents.com/install-wordpress-ubuntu-17-10-nginx-mariadb-php-fpm-lemp/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+siteforstudents+%28Website+For+Students%29

Then, if I type localhost I can see nginx working. I then type localhost/wordpress I get a 502 bad gateway, and if I type localhost/wordpress/index.php then it tries to download the php file (instead of executing it).

What's failing here?

Thanks,

UPDATE: I've been able to install wordpress by following this guide https://www.linuxbabe.com/ubuntu/install-lemp-nginx-mariadb-php7-1-ubuntu-17-10

4
  • Best guess, php isn't working right. Solution work back through the tutorial and find your errors! Dec 21 '17 at 12:54
  • is php or is nginx with php? with the configuration of the guide I should get the webpage with just "localhost/wordpress" right? Dec 21 '17 at 13:22
  • Welcome to Ask Ubuntu. Seems other users had the same problem with this tutorial. Can you please edit your question to include the /var/log/nginx/error.log so other users can have a chance to help you properly. Thank you.
    – Videonauth
    Dec 21 '17 at 13:47
  • the log file contained forbidden access and messages of no such file or directory. I assume I've corrected those messages at some point, since when I surf to the index.php file there's no new entries in the log, so it is that nginx is not using php to process the file (and the browser offers me to download it without any error on his side). Thanks for pointing out that other users have the same problem, that tells me that I'm likely following the guide correctly. Dec 21 '17 at 23:42
0

Check your nginx configuration for the 502 error. For the php file download check whether the correct php is installed on your system. With php --version you should be able to check your php version.

To check your php in your browser, create a html page on your server with following content:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

The page you created should display php information page. If you get a 502 error - it is nginx, if the php is being downloaded, then the php execution on your server is not working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.