root#argenit:/var/www/test.argenit.com.tr/NodeServer# node app.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRNOTAVAIL
at errnoException (net.js:905:11)
at Server._listen2 (net.js:1024:19)
at listen (net.js:1065:10)
at net.js:1147:9
at asyncCallback (dns.js:68:16)
at Object.onanswer [as oncomplete] (dns.js:121:9)
/var/www/test.argenit.com.tr/NodeServer/app.js :
"use strict";
var http = require("http");
http.createServer(processRequest).listen(8000, "test.argenit.com.tr");
function processRequest (request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write("<b>Node.JS'den</b> sevgilerle...");
response.end();
}
/etc/apache2/sites-available/default:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/Argenit
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/test.argenit.com.tr
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName easypath.argenit.com.tr
DocumentRoot /var/www/easypath.argenit.com.tr
</VirtualHost>
<VirtualHost *:80>
ServerName test.argenit.com.tr
DocumentRoot /var/www/test.argenit.com.tr
</VirtualHost>
I want to run nodejs under test.argenit.com.tr subdomain. I wrote a realtime chat module writing with Nodejs and i want to import my php project.
But i couldnt succeed.
I tried proxy pass :
Running Node.js in apache?
Apache and Node.js on the Same Server
Related
<VirtualHost *:80>
ServerName oj.mbstu.ac.bd
ServerAlias www.oj.mbstu.ac.bd
ServerAdmin webmaster#oj.mbstu.ac.bd
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/etc/hosts
127.0.0.1 oj.mbstu.ac.bd
103.28.121.75 oj.mbstu.ac.bd
<VirtualHost *:80>
ServerAdmin yourname#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
This is the proper configuration, but as i can see your document root /var/www/ includes the html, just remove the conf document and include you own index.
Then just restart the apache server
sudo service apache2 reload
I wanted to set up a virtualhost for my apache2 running on my computer. So when I browse to: "invision.jan.pcsg" I get the page contents/folder structure from "/var/www/html/invision"
This is the virtualhost file "invision.jan.pcsg.conf" I created:
<VirtualHost invision.jan.pcsg:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/invision
ServerName invision.jan.pcsg
ServerAlias hkl.mor.pcsg hkl_at.mor.pcsg
<Directory />
Options FollowSymLinks
AllowOverride FileInfo
</Directory>
<Directory /var/www/html/invision/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
When I browse to "invision.jan.pcsg" now, I get redirected to localhost and the "php is working"-page is displayed.
When browsing to "jan.pcsg" the folder contents of "/var/www" is displayed.
Does anyone have an idea why this happens?
I had the same issue but in my case I realized I had forgotten to enable the host .conf file.
sudo a2ensite myvhost.conf
Then I just reloaded apache and everything worked out as expected.
Change your DocumentRoot to directory where your web application ('view' if its MVC) is located.
Usually its : DocumentRoot /home/www-data/ /
I have installed zendserver and it is running on http://localhost:81/.
Now I have created zend framework 2 project in Apache2/htdocs/zend2 and accessing this through http://localhost:81/zend2/public.
I have to set virtual host for this like zend.local but it is not working.
In httpd.conf file
NameVirtualHost *:81
<VirtualHost *:81>
<Directory "C:\Program Files/Zend/Apache2/htdocs/zend2/public">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
DocumentRoot C:\Program Files/Zend/Apache2/htdocs/zend2/public/
ServerName zend.local
ServerAlias zend.local
</VirtualHost>
and In hosts file
127.0.0.1 zend.local
I have tried all possibilities but nothing works.
I recommend installing ubuntu for development i dont see how your doing it on windows and how it doesn’t annoy you.
try this:
make a copy of the default portion and just add ServerName Zend.local then modify the paths and that should work. You might also want to try restarting the computer that sometimes makes it work (rare occasions)
here is a copy of mine that works but its under ubuntu so it might or might not work for you.
<VirtualHost *:80>
#ZEND-{354B5BC7F803049AB79DE95C47F32B59}
Include "/usr/local/zend/etc/sites.d/zend-default-vhost-80.conf"
#ZEND-{354B5BC7F803049AB79DE95C47F32B59}
ServerAdmin webmaster#localhost
ServerName zendapp.dev
DocumentRoot /var/www/vhosts/zendapp/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/vhosts/zendapp/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
#ZEND-{90331A19916187EEA0C9B3A8FE0E1632}
Include "/usr/local/zend/etc/sites.d/globals-*.conf"
Include "/usr/local/zend/etc/sites.d/vhost_*.conf"
#ZEND-{90331A19916187EEA0C9B3A8FE0E1632}
When using Silex, I define a simple route like this:
$app->get('/hello', function() use ($app, $help){
$response = new Response(
json_encode( array("message"=>"hello") ), 400
);
return $response;
});
With: curl -X GET -i -c cookies.txt http://mysite/web/hello.
I get: {"message":"hello"}
But
With: curl -X GET -k -i -c cookies.txt https://mysite/web/hello
I get: HTTP/1.1 404 Not Found
How can I define the same route for both, http and https, based on the security context in the request ?
UPDATE1: EXTRA INFORMATION
Apache2 is configured in the following way:
default
<VirtualHost *:80>
ServerName mysite
DocumentRoot /var/www/mydev
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mydev/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
default-ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName mysite
DocumentRoot /var/www/mydev
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mydev/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
... Using default Apache2 configuration
SSLEngine on
# A self-signed certificate can be ...
SSLCertificateKeyFile /home/user1/ssl/server.key.insecure
...
</VirtualHost>
</IfModule>
I have a problem in Apache2. I changed my root directory to certain folder as in /var/www. I have php files under /html folder. Whenever I try to open any file under /html folder in web browser using link, it does not show anything.
This is how my "default" file looks like.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/web/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
#
#<Directory /var/www/web/>
#<Directory /home/jenismodi/testFolder/>
# Options Indexes FollowSymLinks MultiViews
# AllowOverride None
# Order allow,deny
# allow from all
# </Directory>
# <Directory /var/www/web/html/>
#<Directory /home/jenismodi/testFolder/>
# Options Indexes FollowSymLinks MultiViews
# Order allow,deny
# allow from all
# </Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Can anyone tell me what am I doing wrong here ?
Thanks.
JM
You're forgetting to read your error log.