0

After building my website, I realized that our RAID is setup so that all of the space is allocated in /home/admin/ folder.

For that reason I copied all of my websites from /var/www/ to /home/admin/www/. I also chmodded the directories like so:

sudo chown -R root:root /home/admin/www/website.com/public_html

sudo chmod 755 /home/admin/www

I then restarted nginx and all systems showed green, but now I am getting a 403 error upon accessing my websites.

Here is my virtual.conf file:

server {
    listen       80;
#    listen       *:80;
    server_name  website.com www.website.com;
    access_log   /home/admin/www/html/website.com/public_html/access.log;
    error_log    /home/admin/www/html/website.com/public_html/error.log;

    location / {
        root   /home/admin/www/html/website.com/public_html;
         index  index.php index.html index.htm;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /home/admin/www/html/website.com/public_html$fastcgi_script_name;
    }

}


server {
    listen       80;
#    listen       *:80;
    server_name  website2.com www.website2.com;

    location / {
        root   /home/admin/www/html/website2.com/public_html/;
         index  index.php index.html index.htm;
    }
}

Thanks!

pufAmuf
  • 105
  • 1
  • 3
  • 14
  • 1
    Try to `chown http:http -R /home/admin/www` to the http user. – drewrockshard May 10 '14 at 20:09
  • Yes now I remember, I think I had the same issue before and `chodn http:http` solved it I think. However this time, I'm getting `invalid user: 'http:http'` – pufAmuf May 10 '14 at 20:16
  • Do: `cat /etc/passwd` and check if there is some sort of "web" user. You can also check nginx config to see what user it is using which could also be an issue. – drewrockshard May 10 '14 at 20:29
  • hmm there isn't, other than ftp or nginx that I could think of. Is there a command to find out what users are attached to my old `/var/www/`? – pufAmuf May 10 '14 at 20:42
  • 1
    Yes - on your old vps do `ls -ld /var/www`. You can also check your backed up files to see if there have a UUID and then match that up with your old vps. Check your nginx config file on your new vps (nginx.conf) and you should check the top of the file - should have a user set. If that user does not exist (`id $user_from_nginx_config`) then you need to add the user to the system, which would be the issue to your problem. Let me know how it goes. – drewrockshard May 10 '14 at 21:04
  • Thanks drewrockshard. Everything was okay, nothing was out of the ordinary and the user was set to `nginx` in the config file. The chmod permissions were the same for the old folder and the new alike - except for one thing. I had to set the owner of `/home/admin` to `nginx` - which is interesting really. Do you think that will create an issue in the future, when the owner of the admin account is not the admin?? – pufAmuf May 11 '14 at 23:09

0 Answers0