Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi, I followed all steps, but when i do sudo service nginx restart, warn conflicting server name xxx.xxx.xx.xx on 0.0.0.0:80 ignored nginx. I am not able to access wordpress by keying in IP address on my browser. Any ideas?
This is because you have two server {} blocks that are both listening on the same IP and port.
In your case I’m guessing its either 0.0.0.0 and port 80 or you used the same servername twice which was your public facing IP.
If you remove one server block it will work.
Or if you want both active make sure they have different servernames and/or different ports.
After following these steps, I see “unable to connect to database” when viewing my WordPress site index. Could this be a permissions issue? (I installed WordPress not as root but as another super user.)
The error unable to connect to database indicates that a connection can not be established to the MySQL server which means it has not yet even had a chance to check if the provided credentials, user, pass, and db are valid.
The most common causes of this error are that MySQL is in fact not running, or there is a misconfiguration between the IP address you provided to wordpress to connect to and what IP/port MySQL is actually listening on.
By default MySQL will listen on all IPs and port 3306 so connecting to localhost and the default port in the wordpress configuration should be enough.
You can check to see if MySQL is runnning by either doing:
Or
The telnet command will attempt to connect to the IP and port that MySQL should be listening on. If the connection is established then its working, if it doesn’t then MySQL is most likely not started.
Thanks, raiyu. That’s been very helpful. I’ve rebooted the server and all’s well now. Very impressed with Digital Ocean and will be signing up.
I also had to tweak the permissions of /var/www in order to get WordPress automatic updates and plugin installs to work, using this line:
sudo chown -R www-data:www-data /var/www
Secondly, I’ve made this change to allow editing of files directly via SFTP if required:
sudo usermod -a -G www-data myusername sudo chmod -R g+rw /var/www
Are these worthwhile additions to the tutorial, or are there likely to be any problems caused by these changes?
Both changes are more or less ok, in terms of security you want to avoid having too many directories that are writeable by the user that the web server runs as because wordpress has had exploits in the past which would allow users to upload files directly to your system.
Keeping wordpress running on the latest version avoids the majority of those issues, however it is still something to keep in mind.
I’m going to have Etel run through this tutorial and see about getting the specified changes added to allow for automatic updates and plugin installs - its a good suggestion and should be noted.
We do go back through the tutorials as we get comments on them to make updates, so keep them coming!
Thanks
The only other tweak I’d suggest is to change this line in the location{} block of the virtual host file:
try_files $uri $uri/ /index.html;
to this instead, which enables WordPress’ pretty permalinks under Nginx:
try_files $uri $uri/ /index.php?q=$uri&$args;
You then just need to set the Permalink Settings in the WordPress dashboard to use the “Custom Structure” (the last option), with the relevant tags, for example:
/%postname%/
Thank you for the suggestion!
The configuration has been changed to facilitate Permalinks. :)
Is it possible that you typed in In with “i” as the first letter of the command?
The command is actually ln with “L” as the first letter.
Let me know if the issue continues.