0

I have my own server how can I run symfony project without creating virtual host.

4
  • Is this server only going to run ONE project? Commented Jul 26, 2017 at 12:09
  • Hi Riggs, Thanks for quick reply No there is multiple project hosted there. We are use that using link like 202.x.x.x/projectname. Commented Jul 26, 2017 at 12:10
  • what is the type of own server that run your project xampp or wamp server? Commented Jul 26, 2017 at 12:38
  • Symfony can use the server built into PHP 5.4. Check out the link here: symfony.com/doc/current/setup/built_in_web_server.html Commented Jul 26, 2017 at 13:45

1 Answer 1

4

Do I really need VirtualHost for symfony development?

It all depends on personal preference, if you want to open project with virtual host you can configure it, if not keep like this

localhost/project_folder/web/app_dev.php.

Your symfony app will run with the above URL. I have hosted so many apps on Cloudways and I ran my apps with the URL like this

phpstack-21306-71265-234521.cloudwaysapps.com/fos/web/admin

so I don't need to setup a virtual host either on live server.

Sign up to request clarification or add additional context in comments.

4 Comments

If i crate the new controller then it will give me the 404 error
You need to create routes for the controller methods and call the route in your browser URL. you will get the response. I have published bunch of symfony tutorials you can learn here: cloudways.com/blog/php/symfony
Good, when you create more routes try to access with /web/your_route this will look more clean. And accept my answer as solution :)
You don't need /app_dev.php or whatever if you are using a standard install of symfony as it comes with an .htaccess file that takes care of the rewrites. All you need to remember is that web is considered symfony's 'document root' by default. And that should be your entry point. (or in case of vhosts/live most likely your docroot). so your source files are not 'public'. see symfony.com/doc/current/quick_tour/the_architecture.html that explains it better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.