By Dizazter
Okay, well, I sort of went down the rabbit hole of errors, beginning by attempting to change my newly-made directory ownerships (/var/www/documents and /var/www/projects) to the point where I’m at in the question title above. For reference, I have read the related question, but all seemed fine on that front.
Changing Directory Permissions
First, I visited this piece on GitHub and followed their instructions to chmod 701 user_home. Files I placed in my newly-made directories above would produced a 403 error—I couldn’t read them. If I do resolve the below, this problem still remains.
Unable to Resolve Host
Since that, upon trying to sudo service nginx restart, I’ve been getting the above host resolution error. I’m running Ghost. Now, I have an ERR_CONNECTION_REFUSED, and nothing is loading.
Server + Site Information My /etc/hosts and /etc/hostname contents are below respectively. My droplet’s name is Dizaztrous.
/etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4```
```::1 Dizaztrous Dizaztrous
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6```
/etc/hostname
`ghost`
My site is [www.fromthehiptoss.com](http://fromthehiptoss.com). The realm of server-side maintenance is something I've been barely scraping by with, and it's finally hit me now. I'll be happy to answer any questions you may have, as I'm at a bit of a loss with my site down. Thank you!
**TLDR
Sorry, I'm a bit lengthy—tried to change directory permissions and ended up downing my entire website.**
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!
Alright, so permissions of 701 is very weird. By default in Linux systems, file permissions are 644 and directories 755. But 701 basically says anyone can execute but only that user can do everything. Very insecure to have a file with a 7 in the permission when you don’t need it (or a 1 for that matter). Basically, how you want to go about this is change those permissions back to the defaults (when they were originally created, they might’ve not all been the Linux defaults).
Going from there, it depends on what your running. Could you give me an idea so I know what specific permissions sound good for it?
More information and a handy tool to learn octal “number” permissions.
First up, just for the sake of keeping “junk” out of your /etc/hosts file, the entries below can be safely removed as they do nothing at all :-).
127.0.0.1 Dizaztrous Dizaztrous
::1 Dizaztrous Dizaztrous
If you’re not specifically using IPv6, you can remove the rest of the IPv6 too:
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
In fact, the only thing you really need to define in that file is your hostname with and without your domain attached and localhost, like so:
127.0.0.1 localhost
127.0.1.1 hostname.fromthehiptoss.com hostname
If you’re not sure what your hostname is, you can execute the following from the CLI:
hostname
… and it’ll output what you currently have it set as. If you’d like to change it, you can use the same command and pass a new hostname to it.
hostname newhostname.fromthehiptoss.com
With that out of the way, directories should be chmod 755 and files chmod 644, though setting up these permissions won’t do any good unless your directories are owned by the user who’s executing the scripts (read: files) from said directories.
Note: For the next bit, I’d recommend heading over to PasteBin and copying the requested information to a new PasteBin for each, just to keep things organized :-).
Browse to your home directory, execute the command below and save it to a PasteBin. This command simply lists the files and directories in the directory you run it from and tells us who owns them and what their permissions are set to.
ls -al
Next, if you would, please post the contents of:
/etc/nginx/nginx.conf
and
/etc/nginx/sites-available/yoursite.conf
Where yoursite.conf is the configuration file for your website (note: you may use another directory to store configuration files – this is the default, so please feel free to substitute as needed :-) ).
I’m mainly looking to see who you’re running NGINX as and to also make sure everything in both the NGINX configuration file and your website configuration file looks good so perhaps we can knock out two things at once :-).
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.