dtrj74376 2012-03-02 15:05
浏览 20
已采纳

如何在使用Plesk时动态创建vhost(Apache)?

I've built an app in PHP that runs on Apache. I need to be able to add vhosts on the fly so I would make my app write to sites-enabled and then reload Apache.

The only problem is, I have no choice but to use Plesk on this server as well. What would I edit on Plesk in order to be able to add vhosts on the fly without having Plesk overwrite it or cause any problems?

I've never had the chance to dig into Plesk too much so any guidance would be appreciated.

  • 写回答

2条回答 默认 最新

  • douluan5738 2012-03-08 11:46
    关注

    This is slightly tricky to handle with Plesk as the control panel likes to be in control of the Apache configuration files and certain files are automatically generated by Plesk to ensure that system settings remain consistent.

    There are a number of approaches you could take depending on your requirements.

    1) Make your app setup new sites on the local machine using the Plesk API. This would give you full control of the sites with the control panel and everything that entails. It's also the most complicated solution.

    2) If the sites can be addressed with the same domain, i.e. you are setting up subdomains a simple wildcard entry in the conf/vhost.conf for the master domain record would do it:

    ServerAlias *.mydomain.com

    You could then use this file to also associate other domains with the master domain by writing to it (carefully!) with your app.

    3) Setup and configure the Apache module mod_vhost_alias - although Plesk is likely to cause you a headache with this approach.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?