My apachectl commands sends me back "Illegal option ExecGCI" - apache

i just installed apache by source installation, so after i create virtual host my apachectl doesn't restart, start, stop. My webserver is working i can access but these commands sends me back "illegal option ExeCGI"
This is Virtual host code:
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs"
ServerName node.iplaygrid.com
<Directory "/usr/local/apache/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Thanks.

Looking at the docs: This option is in a module (mod_cgi). Unless that's active, you won't have the directive available. As you built from source, you'd likely also need to build the modules from source, and definitely load them (or rather: it)

Related

Local website not working

I'm having a lot of trouble setting up a local website that I need to do some work on.
I have 2 local sites: "first_training" and "resus_skills"
The former, first_training, works. I have it set up that first_training.loc/ takes me to the local site. resus_skills is set up in the exact same way, but when I try to access resus_skills.loc/ all I get is:
Here are the details of my setup, as well as some screenshots of it:
/etc/apache2/sites-available/resus_skills.conf :
<VirtualHost *:80>
ServerName resus_skills.loc
ServerAlias www.resus_skills.loc
DocumentRoot "/var/www/resus_skills"
<Directory "/var/www/resus_skills">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I made sure to enable it with sudo a2ensite resus_skills.conf and have confirmed that it's symlink is present in ``/etc/apache2/sites-enabled`
I've made sure my apache server is running:
and I've run apachectl -S to get this result:
I am able to reach first_training.loc/ with no issues, but cannot reach resus_skills.loc/.
I'm unsure how to troubleshoot this - the apache error.log isn't showing me anything.
Before anyone points out what an idiot I've been - I never updated the /etc/hosts file, which was the only missing step.

using flask virtualenv on remote host (not locally)

I have a CentOS 7 WSGI enables Apache Httpd server (on a VirtualBox machine) and it serves my developing Flask site at http://www.myflask.com on port 80.
Since I can't debug there (even if I tried everything I could), like I can on a local version set in a virutalenv at http://127.0.0.1:5000, I was trying to do this:
setting up a virtualenv (with flask installed) on the VB server, called myflaskv (/var/www/myflaskv)
putting myflask dir into myflaskv (/var/www/myflaskv/myflask)
I did end with the following httpd.conf virtual host section:
<VirtualHost *:80>
DocumentRoot "/var/www/myflaskv/myflask"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/myflaskv/myflask">
Options Indexes FollowSymLinks MultiViews
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /var/www/myflaskv/myflask/index.wsgi
ServerName www.myflask.com:80
</VirtualHost>
I can load the page http://www.myflask.com (even with virtualenv activated) but I can't load the page http://www.myflask.com:5000 as I would suppose to debug.
So I tried to add a virtualhost on port 5000:
<VirtualHost *:5000>
DocumentRoot "/var/www/myflaskv/myflask"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/myflaskv/myflask">
Options Indexes FollowSymLinks MultiViews
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /var/www/myflaskv/myflask/index.wsgi
ServerName www.myflaskv.com:5000
</VirtualHost>
supposing that this way I could load http://www.myfaskv.com, and instead I can't (ERR_CONNECTION_REFUSED).
By the way I temporarly disactivated ip-tables and se-linux.
So is there a way to load from browser the 127.0.0.1:5000 ip address of a remote host?
Or there is a better way to debug flask in an wsgi apache dev environment?
If you want to access the url from outside the box, you will have to run the server at 0.0.0.0:5000.
The url http://127.0.0.1:5000 cannot be accessed from outside the box you are running it in.
When you use wsgi to access your app, the error messages and stack traces are written to the web server error log, by default at /var/log/apache2/error.log. You don't need to use the virtualenv web server. Just write any debug output you need to a local log file (if you have debugging input you want to print) and look for the stack traces in the apache error log.

Setting root directory in a development environment

I have a linux server that I do all of my web development on. I cant find an example of a virtual host.
I need a way to set virtual hosts (i think) so that even when i am running http://dev.example.com/blah i need that URL to be treated as a different site.
I know that i cannot use sub domains because to access the server I have to navigate through a sub domain.
If you need any clarifications please ask.
Virtual hosts are set using a <VirtualHost> section in apache configuration file(s) generally being httpd.conf,apache2.conf.It looks like
<VirtualHost *:80>
ServerAdmin webmaster#dev.example.com
ServerName dev.example.com
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>
</VirtualHost>
You can change DocumentRoot as per your convenience.
In few versions of distros such different sections of main trivial configuration file httpd.conf are segregated to separate files.
For example apache2 on latest ubuntu has separate files per virtual host located at /etc/apache2/sites-enabled/
You may find 000-default already in this directory which sets the default host(localhost)
You may copy it and start editing to define a new virtual host.With above snippet you will be configuring new host. Key point is setting DocumentRoot to a different directory for dev.example.com to configure as a different site.
I assume your dev machine is able to resolve what is set for ServerName else you may want to configure it too in /etc/hosts on debian based linux.

Accessing virtual host from computer on same local network

I am trying to make a setup so that I can access my website on a virtual host in computer A from computer B. Both A and B are on the same network.
I am using xampp on Win 7.
So here is as the problem goes computer A(server) has a virtual host configuration as follows in the httpd-vhosts.conf file.
NameVirtualHost project:81
<VirtualHost project:81>
DocumentRoot "D:/work/website"
ServerName project:81
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
(using port 81 as port 80 has IIS running, dont know much about these things however)
this configuration works fine on the local machine(server). i.e project:81 in the address bar of the browser opens up the website as it should.
Now on computer B(client) I changed the hosts file to contain the IP of the server along with the name of the virtual host like:-
192.168.1.7 project
now when I enter project:81 on the client browser .. it takes me to the server but its not taking me to the virtual host directory, instead it takes to the default directory .. i.e in my case is
C:\xampp\htdocs
Now I am stuck and unable to make the client to point to the current destination.
So can anybody suggest what I am doing wrong here or something else I need to do in order to have access to the correct virtual host site from the client machine.
Thanks in advance for any help
Ok So Seto El Kahfi's reply to my very old question led me to do some more research and reading on Apache's website.
So what I got is this, my NameVirtualHost directive was improper.
So Instead of this,
NameVirtualHost project:81
<VirtualHost project:81>
DocumentRoot "D:/work/website"
ServerName project:81
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
What I had to do was this.
NameVirtualHost *:81
<VirtualHost *:81>
DocumentRoot "D:/work/website"
ServerName project
<Directory "D:/work/website">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Notice the ' * ' , I could have used an IP Address there too.(In this case my server's(machine A) local IP) both work. Now all I had to do is enter "project:81" on the client machine, and I get what my eyes wished to see.. :)
Few things I got from this.
1) How to use NameVirtualHost(or what it's purpose basically is.). Read More here
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost
This one is also good http://www.thegeekstuff.com/2011/07/apache-virtual-host/
2)You can use this via command line:
httpd -D DUMP_VHOSTS
to know how your virtual hosts are setup(will also give you some warnings regarding precedence if something's wrong with your setup)
3)Other's gesture to help you makes you help yourself.. :) So keeping helping and rocking.
Have you try to include the port at your client host's file?
192.168.1.7:81 project

Apache Stopped Following Symlinks

Yesterday, I had a fistful of sites running locally with no problem. Today, nothing opens and I have a log full of this:
Symbolic link not allowed or link target not accessible: /var/www
I have no idea what I did (I didn't open/change my httpd.conf file in any way), but clearly it was something bad. I run virtual hosts and the root directories are located in ~/Developer/www. In order to share the config files across multiple Macs with different home directories, I've created a symlink, /var/www which points to ~/Developer/www.
All of the virtualhost config files point their DocumentRoot to /var/www/project_directory and its own root directory has the FollowSymLinks option:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost.local localhost.dev
DocumentRoot /var/www/_localhost
<Directory /var/www/_localhost>
Options FollowSymLinks Indexes
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
My main httpd.conf file, similarly, has the FollowSymLinks option enabled for /:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Any idea what I could have done to stop Apache from understanding symlinks or, better yet, what I can do to get it back on track?
Thanks.
UPDATE:
I should add that all of the directories in the "stack" are executable by all users and that this is the native Apache install on OS X Lion.
I guess I made an assumption that I shouldn't have. I had verified every relevant permission except the one that evidently mattered. Apache didn't have execute permissions on my top level home directory. I checked, re-checked and triple checked everything under that, but having never changed anything in that directory itself, I just didn't anticipate it being the issue.