Error 503 Service unavailable - symfony

just started with Symfony2 and already have a problem that i can not solve.
Installed the Symfony2 demo app on a VPS with debian. but trying to open it give me a "503 Service unavailable".
I used 'symfony demo' to install to /var/www/symfony_demo/
then added a symdemo.conf file to /etc/apache2/sites-available that look like this:
NameVirtualHost XX.XXX.XX.XXX
<VirtualHost XX.XXX.XX.XXX>
ServerName symblog.dev
DocumentRoot "/var/www/symfony_demo/web"
DirectoryIndex app.php
<Directory "/var/www/symfony_demo/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
XX.XXX.XX.XXX = public server IP
and activated it with a2ensite symdemo.conf
I thought that would work, but opening the IP give me the error message.
and trying to open app_dev.php give me not allowed to access this file
Could someone please give me a tip?

Nevermind. Looks like i fixed it. Following this tutorial: http://intelligentbee.com/blog/2013/08/07/symfony2-jobeet-day-1-starting-up-the-project/
just activate mod_rewrite with a2enmod rewrite and restart apache. that's it.

Related

Object not found! wordpress

I locally setup a wordpress project by using a backup and the sub pages are not working in the project only giving the error message below eg- when i tried to go to the about us page it gives the below error in the browser
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.2.26
It's look like server error, Please confirm that you have correctly setup vertual host.
Here is code to create virtual host.
On Xampp:
<VirtualHost wp.local:80>
DocumentRoot "D:\dev\wp"
ServerName wp.local
ServerAlias wp.local
<Directory "D:\dev\wp">
DirectoryIndex index.php
Require all granted
Allowoverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Home Page Wordpress on Free MAMP does not work

I have installed MAMP (free version) on my Mac and I see the Start Page but I have a problem:
I deployed wordpress but browser say unable to connect (basically I cannot see wordpress page in browser).
In Document Root if I put a static html file I am able to see it in the browser. I am also able to see wordpress administrative pages and all other pages but home page. I have 8888 and 8889 for php and mysql ports. I do not know how to debug the issues. php, apache and mysql do not report any particular problems.
I configured virtual hosts following this guide:
http://foundationphp.com/tutorials/vhosts_mamp.php
The strange thing when I put http://localhost:8888/mywebsite in the browser it is redirected to localhost/mywebsite.
In /etc/hosts I have:
127.0.0.1 localhost
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
and in this file I have:
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common
</VirtualHost>
Hope someone could help.
I found the solution. After several debugging I found that this guide is correct: http://foundationphp.com/tutorials/vhosts_mamp.php
You need: 1. In /etc/hosts add your virtual hosts like:
127.0.0.1 localhost
127.0.0.1 mywebsite
before I only used localhost because I hoped to use this host in browser but I found it's required to define a new host like mywebsite.
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
In this file I have:
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName mywebsite
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common

Opening ZF3 skeleton-application shows only source code but not the web page

I setup a new development machine with my Mac.
Now I installed the zend framework skeleton-application.
When I open the url, it will show me the source code of index.php into my browser and not the web site.
Into /etc/apache2/httpd-vhosts.conf I added this:
<VirtualHost *:80>
ServerName test.dev
ServerAdmin info#abc.de
DocumentRoot "/Users/myname/Projekte/web/test/public/"
SetEnv APPLICATION_ENV "development"
<Directory "/Users/myname/Projekte/web/test/public/" >
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/test.dev-error_log"
CustomLog "/private/var/log/apache2/test.dev-access_log" common
What can I do to solve this problem?
Do I need a .htaccess at into my public directory?
Thanks for help.
Just to write a proper answer as the problem has been solved in comments.
So the problem was that an http request got back the source code as a response. Obviously, this is not a Zend Framework related question but rather a server configuration issue.
In order to properly diagnose the problem, one could use the most simple php code and directly try to access the script, hence dismissing the framework related issue. <?php phpinfo(); is a good test for instance.
Apache has two ways to make php interpreted: php-fpm and mod_php. One of those at least must be configured in order for Apache to pass the files to the interpreter.
In this specific case, the module was installed on the machine but not loaded in the configuration file, which has been done using the following line in apache config file:
LoadModule php5_module libexec/apache2/libphp5.so

wordpress forbidden 403 error

After installing wordpress and following all the steps when I am go to http://localhost, I am gettong 403 Forbidden error.
How can I resolve this?
Ubuntu 14.04 is my OS.
In normal case changing permission and updating .htaccess should fix this issue, but in your case it is not working, so try to create a host entry and see if it is working. Else it will be related to the server configuration.
a. Create a new folder inside /var/www (example: wordpress - with proper permissions)
b. Copy all files from /var/www/html folder to /var/www/wordpress
c. Create a virtual host entry: sudo gedit /etc/apache2/sites-available/wordpress.conf
Add following contents:
<VirtualHost *:80>
ServerName wordpress
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
</VirtualHost>
d. Update hosts: sudo gedit /etc/hosts
Add new line: 127.0.1.1 wordpress
e. Activate new website: sudo a2ensite wordpress.conf
d. Restart apache: sudo service apache2 restart
Access http://wordpress from your web browser.

Hosting multiple domains in Apache2 - how?

Although I’ve found related articles on stackoverflow, I have seen various suggestions which I’ve tried out but I still experience problems, so that’s the reason why I’m posting this.
I have a question which involves DNS, Debian, Apache2 and Wordpress. I’ve been struggling with this for some time now and haven’t been able to solve it. My current conclusion is that 2there is something with my dns and apache virtual host definitions”, but, as I said I’m far from sure.
This is what my config looks like:
two domains which I “own” hosted by moniker.com - let’s call them domaina and domainb
a hosted vps with Debian, apache2 and wordpress. The vps has ip x.y.z.t
each domain has three ‘A’ records defined: ‘*’, ‘#’ and ‘www’
URL rewrite enabled (a2enmod rewrite)
Wordpress installed and links created to the wordpress directory for both document directories specified in the virtualhost directives below
Both ‘domaina’ and ‘domainb’ point to my vps and this is working ok. However, what I’ve been unable to solve is to have the vps handle “multiple virtual hosts”. I thought I would be able to handle this by using virtual hosts in Apache. For that purpose I’ve defined two sites under /etc/apache2/sites-available which looks like this:
(file: /etc/apache2/sites-available/domaina.com)
<VirtualHost x.y.z.t:80>
ServerName domaina.com
ServerAdmin me#domaina.com
DocumentRoot /var/www/domaina.com
DirectoryIndex index.php
<Directory /var/www/domaina.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
(file: /etc/apache2/sites-available/domainb.com)
<VirtualHost x.y.z.t:80>
ServerName domainb.com
ServerAdmin me#domainab.com
DocumentRoot /var/www/domainb.com
DirectoryIndex index.php
<Directory /var/www/domainb.com/>
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Now, when I try to address the sites above from a web-browser I end up at the default apache directory with the index.html file rendered in the browser instead of arriving at the two different wordpress configurations. Obviously there’s something wrong with my thinking around “VirtualHosts” and/or DNS-configurations…
I forgot to mention that I've made loads of /etc/unit.d/apache2 restarts... Sorry...
Frankly speaking I’m lost here and any help on this would be very much appreciated.
Cheers
If you did restart apache and its still not working please respond, as I have experienced similar issues with Apache, especially when getting the virtual host to work. I realise your running on Debian which is different to WAMP, but this is what I do when opening a new virtual host.
First I add the domain to the windows system 32 drivers etc hosts file, it allows for intranet
127.0.0.1 domainname and this stops the url from looking to the web.
Then I have to add the corret directories to the www/your folder.
Just inside the root folder there ought to be a directory called vhosts,
I had to make totaly empty instances of the conf files with just the filename of the virtual hosts inside it so that the changes you made to the httpd-vhosts.conf works.
So what you will need to do is find the wamp/bin/apache/Apache2.2.21/conf/extra/httpd-vhosts makes sure that you have the one from the conf/axtra and not conf/orginal.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/**name of the folder**"
ServerName **as_inserted_in_hosts**
<directory "c:/wamp/www//**name of the folder**">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
Save. Apache stop all services, I also have to restart the service running the intranet in windows to update the changes to the hosts file and then restart apache.
This is what I have to do so that when I open localhost from Apache it allows me to see the links appear under virtual hosts as well as the directories appearing under your projects.
Have a look at this tutorial... Explains how to set up virtual hosts
Do you have a NameVirtualHost directive in your apache2.conf anywhere? You'll need that to enable virtual hosting. It can go in apache2.conf or any file included by apache2.conf. On my server I've got it in ports.conf.
NameVirtualHost *:80
See http://httpd.apache.org/docs/2.2/vhosts/name-based.html#using

Resources