Eugeny / ajenti-v

Virtual Hosting addon for Ajenti
ajenti.org/#product-ajenti-v
MIT License
225 stars 80 forks source link

Problem with vhost #105

Closed DenBeke closed 10 years ago

DenBeke commented 10 years ago

Before installing Ajenti V, I configured two websites in 'normal' Ajenti, which worked perfectly. After installing Ajenti V I added one of those sites again, but when accessing PHP files, nginx keeps making them downloads...

When restarting nginx manually I got this: nginx: [warn] conflicting server name "mactua.eu" on 0.0.0.0:80, ignored

Can it be that there are more configuration files, but that Ajenti is using the wrong one? (or nginx selecting the old one?)

Eugeny commented 10 years ago
DenBeke commented 10 years ago

What do you mean with make sure that your content entry is of PHP type ?

Eugeny commented 10 years ago

It's important to select right type when creating content entry, otherwise .php files will get downloaded instead of being executed:

Also, please post your generated /etc/nginx/conf.d/<website>.conf file.

DenBeke commented 10 years ago

I have set it like this: The same thing works for other vhosts. So I think there must be a particular problem here...

schermafbeelding 2014-09-09 om 19 09 39

Eugeny commented 10 years ago

This looks ok. Please post the config file mentioned above.

DenBeke commented 10 years ago

I'm sorry, didn't read about the config file... So I've checked out the conf.d directory, and found out that there are listed multiple .conf files with the mactua.eu name. I will try to remove all of them and add the vhost again from the Ajenti V websites tab.

…x/conf.d/_.conf …x/conf.d/denbekebe.conf …x/conf.d/mactua.conf …x/conf.d/mactuaeu.conf …x/conf.d/samenspelmerksem.conf

Eugeny commented 10 years ago

These files are all coming from websites defined in Ajenti V (i.e. there are no "junk" files). After you apply website configuration, they will be regenerated. Just post the file for the website with which you have the problem.

DenBeke commented 10 years ago

I think Ajenti had a problem, because there are from vhost I have deleted still files in that folder...

The hosts in the Ajenti V panel:
schermafbeelding 2014-09-09 om 19 44 42

The files in the /etc/nginx/conf.d/ dir:
_.conf denbekebe.conf mactua.conf mactuaeu.conf samenspelmerksem.conf

I had a problem with a site staying in maintenance mode. So I restarted Ajenti and Nginx manually. Could that have caused a problem?

The two mactua.eu files: First one is mactuaeu.conf, second one is mactua.conf

#AUTOMATICALLY GENERATED - DO NO EDIT!

server {
    listen *:80;

    server_name mactua.eu;

    access_log /var/log/nginx/mactuaeu.access.log;
    error_log /var/log/nginx/mactuaeu.error.log;

    root /home/mathias/Sites/Mactua;
    index index.html index.htm index.php;

    location / {
        return 503;
        error_page 503 @maintenance;
    }

    location @maintenance {
        root /var/lib/ajenti/plugins/vh/extras;
        rewrite ^(.*)$ /maintenance.html break;
    }

}
#AUTOMATICALLY GENERATED - DO NO EDIT!

server {
    listen *:80;

    server_name mactua.eu www.mactua.eu;

    access_log /var/log/nginx/mactua.access.log;
    error_log /var/log/nginx/mactua.error.log;

    root /home/mathias/Sites/mactua;
    index index.html index.htm index.php;

}
Eugeny commented 10 years ago

Can you confirm that clicking Restart websites doesn't remove extra files from /etc/nginx/conf.d?

DenBeke commented 10 years ago

I have clicked the bottom left Restart websites button twice, but I'm still having more files than vhosts.

schermafbeelding 2014-09-09 om 20 20 22

_.conf denbekebe.conf mactua.conf mactuaeu.conf samenspelmerksem.conf

DenBeke commented 10 years ago

Should I manually remove all the files and create the vhosts again?

Eugeny commented 10 years ago

Please send your /etc/ajenti/vh.json file to e@ajenti.org

Eugeny commented 10 years ago

Found your problem. You have first created websites as root user, and then relogged in as another user, and created them again. Users can't see websites created by other users, while root can see all websites. You need to either migrate your websites to the new user (see the support website on how to use ajenti-ipc to export and import websites) or use root use to manage them.

DenBeke commented 10 years ago

Ow, thank you for sorting this out! I'm sorry for wasting your time on such a stupid thing...

Besides... Shouldn't there be a safety to prevent double websites?

Eugeny commented 10 years ago

Well, it should be there, but we're still in beta, so - sorry! :)

DenBeke commented 10 years ago

Yeah, no problem, was't meant to be a hard comment, but more to make sure you wouldn't forget something like that :)

I'm really overwhelmed by Ajenti and Ajenti V, it works very well, with a super clean interface!