• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

vhost.conf question

Amin Taheri

Golden Pleskian
Plesk Certified Professional
Hello guys,

I have a question about vhost.conf file

I have a domain, domain.com, which I want to have seperate settings.

So I go to /var/vhosts/www/domain.com/conf and create a vhost.conf file

In the file it has only

Code:
<VirtualHost Server_IP_Here:80>
SecRuleRemoveByID 960015
SecRuleRemoveByID 960034
</VirtualHost>

I restart apache after saving the file - server restarts fine, but the changes are not done.

If I put these changes directly in httpd.include in the same directory and restart apache the changes work fine - so I know there are no problems with the command.

I tried searching for something like this, but I didnt really find anything too terribly relevant, but its possible I missed something.
Am I doing something wrong, or missing a step?

Thanks in advance.
 
I think you are using the wrong syntax.

You should use

<Directory /home/httpd/vhosts/somedomain.com/httpdocs>
SecRuleRemoveById xxx
SecRuleRemoveById xxx
</Directory>

The path above assumes your vhosts in in /home/httpd but on fresh installs of Plesk 8.x it would be /var/www/vhosts/domedomain.com/httpdocs


Don't forget you then need to use
websrvmng -u --vhost-name=somedomain.com

then restart httpd
 
Hi, thanks for the response. its still not working for me, perhaps you can tell me if I missed a step?

I created a new file called vhost.conf and put it in the /var/www/vhosts/domain.com/httpdocs directory.

The file contains the following (domain is real in the file though)

Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
SecRuleRemoveById xxx
SecRuleRemoveById xxx
</Directory>

I then ran
Code:
# /usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com

# /sbin/service httpd restart
Stopping httpd:                           [  OK  ]
Starting httpd:                                            [  OK  ]

Still doesn't work :(
 
Ah! vhost.conf needs to be in the /var/www/vhosts/domains.com/conf directory, not httpdocs.

That's all that's wrong.

You'll see in the same conf directory the main include files that Plesk adds to the apache conf for that domain. Do not edit those files as they get overwritten by plesk. You'll see an include in them for the vhost.conf file (and vhost_ssl.conf for https)

Faris.
 
heh ok - I guess I misread your instructions. I moved the file back to the conf directory and restarted apache, still no joy.

Basically what I am doing in a nut shell is that I am removing two mod sec rules from a site. If I put those two rules into the httpd.include file for this domain and restart apache then it works as intended.

At present it is still not working with the file in the conf directory. But its still not working :(

Edit: I finally got it working, I forgot that I needed to do the websrvmng command twice - once for @none and once for www. :p

Thanks for all your help, its appreciated :)
 
Originally posted by HostingGuy

I finally got it working, I forgot that I needed to do the websrvmng command twice - once for @none and once for www. :p

I don't quite understand that. When you specify the domain after --vhost-name= that's just telling to to deal completely with the domain. It doesn't know about www and non-www it only knows about domain.com not www.domain.com if you see what I mean.

I'm glad you got it working though! I've earned my Brownie points for the day.

Faris.
 
Back
Top