doutang7415 2011-11-25 06:38
浏览 38
已采纳

在PHP中创建虚拟主机

I am trying to set up symfony on my Ubuntu system. Now as going through the installation tutorial of symfony I found to Create a virtual host for my (to be created) application. I did the same steps as bellow.

httpd.conf

NameVirtualHost 127.0.0.1:9090
Listen 127.0.0.1:9090
<VirtualHost 127.0.0.1:9090>
ServerName www.symfony.jobeet.lcl
DocumentRoot "/home/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>

And Here is My /etc/hosts file

127.0.0.1   www.symfony.jobeet.lcl

Now I restarts my lampp server and entered www.symfony.jobeet.lcl in my browser it takes me to http://www.symfony.jobeet.lcl/xampp/ this Url. If I try without using virtual host, It works fine. also when I try www.symfony.jobeet.lcl:9090 It works. I expect it should work without giving the port number. Am I doing something wrong ?

  • 写回答

2条回答 默认 最新

  • dpklt4291 2011-11-25 06:56
    关注

    I have created the simple bash script to simplify the process of new hosts creation. So that you don't have to do anything with config files, etc. Check if you are interested here.

    Creating new host is as simple as running a command from terminal $ sudo ./newhost.sh. Then you will be asked to enter desired host name.

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

报告相同问题?

悬赏问题

  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真