gitweb not showing details about repos - apache

I have apache 2.4 on a windows 2008r2 serving a collection of bare msysgit repositories and I want to enable the gitweb frontend to browse the contents. I am able to clone and push to repos. When I configure gitweb the list of repos are shown but the contents of the repos are not visible. For example the commit link shows "404 - Unknown commit object".
Here is the apache configuration for gitweb
Alias /gitweb/ "C:/Program Files (x86)/Git/share/gitweb/"
<Directory "C:/Program Files (x86)/Git/share/gitweb">
<Files ~ "\.cgi$">
Options +ExecCGI
</Files>
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex gitweb.cgi
</Directory>
I modified the gitweb.cgi to point to the location of the msysgit's perl
#!C:/Program Files (x86)/Git/bin/perl
and the projectroot to
our $projectroot = "/C/git_repos";
Here is the apache configuration for git
SetEnv GIT_PROJECT_ROOT "C:/git_repos"
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
ScriptAlias /git/ "C:/Program Files (x86)/Git/libexec/git-core/git-http-backend.exe/"
What am I missing?

Related

How to run multiple PHP version with XAMPP?

I have multiple projects based on PHP. Some require PHP version 5.x to run and other strictly require PHP 7.0 or above. I am working on these simultaneously. Is there a way to run multiple PHP versions such that I can switch between them when working on different projects.
Try these steps:
Stop LAMP if running.
Download libphp7.so if you don't have
https://github.com/prashant-techindustan/php7module_library/blob/master/libphp7.so
Edit /opt/lampp/etc/extra/httpd-xampp.conf (Comment out one of the following which is not needed):
LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
Start LAMP
>> Open C:\xampp\apache\conf\extra\httpd-xampp.conf
>> Write Following code at Bottom of this (httpd-xampp.conf) file
ScriptAlias /php56 "C:/xampp/php56"
<Directory "C:/xampp/php56">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
</Directory>
>> Open C:\xampp\apache\conf\extra\httpd-vhosts.conf\httpd-vhosts.conf
>> Create a virchual host in Different post By Writing Following code
<VirtualHost *:8081>
UnsetEnv PHPRC
<FilesMatch "\.php$">
php_flag engine off
SetHandler application/x-httpd-php5_6
Action application/x-httpd-php5_6 "/php5_6/php-cgi.exe"
</FilesMatch>
DocumentRoot "C:/xampp/htdocs/myphp5_6_project"
</VirtualHost>
>> Create a folder "myphp5_6_project" in htdocs of xampp
>> Open C:\xampp\apache\conf\httpd.conf
>> Write Listen 8081 (any where or Below Listen 80 line)
>> Restart Apache Services

Forbidden Angular 2 in Apache 2.4 on Centos 7

I try to deploy Angular 2 Webpack starter in my server centos 7 with Apache 2.4 but when i enter to the server domain ip from my laptop browser that send me a forbidden message.
Well the Angular 2 webpack was installed in /var/www/html/ directory and the document root from httpd.conf file is /var/www/html/src/ where are the index.html Angular 2 and i have the following config in httpd.conf file
<Directory />
AllowOverride All
Require all granted
</Directory>
<Directory "/var/www">
AllowOverride All
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Pls Help.
Regards.
first, you need build your app with command
# production (jit)
npm run build:prod
# AoT
npm run build:aot
after built successful, you got dist directory, you can rename it, then copy to html dir in /var/www/html
config apache with same config in your post.

You don't have permission to access / on this server

I have CentOS 6.1 server and I installed apache 2.2.15 on it.
Now When I try to access it from another pc (windows 7) from IE (http:/// (=centos ip)) I get the "You don't have permission to access / on this server." error. I even created phpinfo.php file with content of "" on "var/www/html" and when I try to access it by using "http://*/phpinfo.php" in IE, I get not found error. What should I do?
my httpd.conf for directiry is like this:
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Edit httpd.conf file, which is in /etc/httpd/conf/httpd.conf. Add the below code.
<Directory "/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
<Directory "/home/">
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Allow from all
</Directory>
After the line no. 555 (in my case) . Check for the file permissions and restart the server.
service httpd restart
Now, it will work . Still you are facing the same problem, disable the seLinux in /etc/selinux/config change SELINUX=disabled and restart the server as mentioned above and try it.
Hope this helps
Set SELinux in Permissive Mode using the command below:
setenforce 0;
Check file permissions of the /var/www/html and the ALLOW directive in your apache conf
Make sure all files are readable by the webserver and the allow directive is like
<Directory "/var/www/html">
Order allow,deny
Allow from all
</Directory>
if you can see files then consider sorting the directive to be more restrictive
Fist check that apache is running. service httpd restart for restarting
CentOS 6 comes with SELinux activated, so, either change the policy or disabled it by editing /etc/sysconfig/selinux setting SELINUX=disabled. Then restart
Then check locally (from centos) if apache is working.
Try to use the following:
chmod +rx /home/*
If you set SELinux in permissive mode (command setenforce 0) and it works (worked for me) then you can run restorecon (sudo restorecon -Rv /var/www/html/) which set the correct context to the files in Apache directory permanently because setenforce is temporal. The context for Apache is httpd_sys_content_t and you can verify it running the command ls -Z /var/www/html/ that outputs something like:
-rwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 index.html
In case the file does not have the right context, appear something like this:
drwxr-xr-x. root root unconfined_u:object_r:user_home_t:s0 tests
Hope it can help you.
PD: excuse me my English
Create index.html or index.php file in root directory (in your case - /var/www/html, as #jabaldonedo mentioned)
Right click your www folder and click on properties. Navigate to permissions and change all to read and write then click on "Apply permission to enclosed files" and your are done!!
Maybe its too late but this will definitely help some other person
Check the apache User and Group setting in the httpd.conf. It should default to apache on AMI/RedHat or www-data on Debian.
grep '^Group\|^User' /etc/httpd/conf/httpd.conf
Then add the apache user to the group setting of your site's root directory.
sudo usermod -a -G <your-site-root-dir-group> apache
try to edit httpd.conf
<Directory "/usr/local/www/apache24/cgi-bin">
Options Indexes FollowSymLinks Includes ExecCGI
Require all granted
</Directory>
For CentOS 8 your /etc/httpd/conf.d/awstats.conf file needs to look like this and you need to stick in your IP address and restart your httpd service unless you want to whole world to have access to it!
#
# Directives to add to your Apache conf file to allow use of AWStats as a CGI.
# Note that path "/usr/share/awstats/" must reflect your AWStats install path.
#
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/share/awstats/wwwroot">
Options None
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require <Your IP Address here>
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Allow from <Your IP address here>
Allow from ::1
</IfModule>
</Directory>
# Additional Perl modules
<IfModule mod_env.c>
SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
</IfModule>
Remember that if you IP address changes you need to update the file and restart the httpd server. BTW you can see your ip address as it looks from the outside by simply googling "my ip"
Set required all granted in /etc/httpd/conf/httpd.conf

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.

Apache attempting to load from /var/cache for munin

I'm trying to get the Munin webpage working under Apache2 via SSL on Debian Etch. My config for the website is:
NameVirtualHost 1.2.3.4:80
<VirtualHost www.mydomain.org:80>
ServerName www.mydomain.org
...
<Directory /var/www/https>
AllowOverride None
Order deny,allow
Deny from all
</Directory>
...
</VirtualHost>
<VirtualHost www.mydomain.org:443>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/https/
SSLEngine On
SSLCertificateFile /etc/blah
SSLCertificateKeyFile /etc/blah
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
...
<LOCATION /munin>
Options Indexes FollowSymLinks MultiViews
AuthType Basic
AuthName "Munin Users"
AuthUserFile /etc/apache2/auth-files/munin
<limit GET PUT POST>
require valid-user
</limit>
Order allow,deny
allow from all
</LOCATION>
...
</VirtualHost>
Munin is configured to use the directory and the files are created and refereshed in the proper location. I can go to https://www.mydomain.org/munin/, enter a username and password, and see the top page fine. But when I try to drill down to the actual information, I get a 404 error:
Not Found
The requested URL /munin/localdomain/localhost.localdomain/apache_accesses.html was not found on this server.
The URL listed is the same URL that's in the URL of the browser window. But when I look in the error log, I see:
File does not exist: /var/cache/munin/www/localdomain/localhost.localdomain/apache_accesses.html, referer: https://www.mydomain.org/munin/localdomain/index.html
The index.html file lists the file name as localdomain/localhost.localdomain/apache_accesses.html.
I do not have the cache module loaded:
root#etch:/etc/apache2/mods-enabled# ls
alias.conf authz_default.load autoindex.load dir.conf mime.load reqtimeout.conf ssl.load alias.load authz_groupfile.load cgi.load dir.load negotiation.conf reqtimeout.load status.conf auth_basic.load authz_host.load dav.load env.load negotiation.load rewrite.load status.load auth_digest.load authz_user.load dav_fs.conf include.load php5.conf setenvif.conf authn_file.load autoindex.conf dav_fs.load mime.conf php5.load setenvif.load
I do not have any directives to enable caching in my apache config:
root#etch:/etc/apache2# grep -i cache *
apache2.conf:#SSLSessionCache dbm:/var/cache/apache2/ssl_cache
apache2.conf:SSLSessionCache none
(The dbm cache line is commented out and I've restarted apache numerous times.)
root#etch:/etc/apache2/sites-enabled# grep -i cache *
(zero lines returned.)
So why in the heck is apache trying to load the files from the /var/cache directory rather than the /var/www/https/munin directory? Any help greatly appreciated.
I do not know for certain how it works on Debian, but the Ubuntu package for munin creates a config file in /etc/apache2/conf.d/munin.
This config file specifies an alias for /munin : Alias /munin /var/cache/munin/www
/var/cache/munin/www is the default htmldir value for recent munin versions.