I'm trying to configure httpd on fedora, but my two day effort has gotten me nowhere.
I installed httpd and php, added the configuration file for the site, everything is fine. I try to load it and see "access denied." but I have already granted to the apache user and apache group 755 rights (on every folder along the path).
Errors in apache log:
[Mon Jun 06 20:25:18.088420 2022] [negotiation:error] [pid 12656:tid
12758] (13)Permission denied: [client 127.0.0.1:45920] AH00686: cannot
read directory for multi: /home/concasse_master/Desktop/sample/public/
[Mon Jun 06 20:25:18.089421 2022] [proxy_fcgi:error] [pid 12656:tid
12758] [client 127.0.0.1:45920] AH01071: Got error 'Unable to open
primary script: /home/concasse_master/Desktop/sample/public/index.php
(Permission denied)'
localhost.conf:
<VirtualHost *:8080>
ServerName localhost
DocumentRoot /home/concasse_master/Desktop/sample/public
ErrorLog logs/error.log
CustomLog logs/access.log combined
<Directory /home/concasse_master/Desktop/sample/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Related
ServerAdmin webmaster#localhost
DocumentRoot /home/sachin/neuu-dashboard/Telemetry_Backend/www
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/sachin/neuu-dashboard/Telemetry_Backend/www>
Options FollowSymLinks
AllowOverride All
#Order deny,allow
#Allow from all
Require all granted
</Directory>
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
my apache is keep on crashing when am setting up a php framework
apache is working fine when it is pointing to a default var/www/html
after changing the path it asked enmod and rewrite that also i did but still it is crashing
as soon as i restarted on the very 1st request it crashed
the error code is below from error.log
[Sun Dec 09 13:04:31.953572 2018] [mpm_prefork:notice] [pid 24209] AH00169: caught SIGTERM, shutting down
[Sun Dec 09 13:04:32.048381 2018] [mpm_prefork:notice] [pid 24328] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Dec 09 13:04:32.048453 2018] [core:notice] [pid 24328] AH00094: Command line: '/usr/sbin/apache2'
help me out to set up the php framework
I have setup my fedora system, the default was that / size is 50gb while remaining drives where put on /home.
since I don't want to waste my precious 50gb for my web project I setup my apache web server as follow
since the default of apache is /var/www/html
i remove html dir and replace it with a symbolic link that points to my /home/user/www/html
note /home, /home/user, /home/user/www, /home/user/www/html have x permission for apache
my conf is like this
DocumentRoot "/var/www/html"
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I already restart my httpd service and it was fine. The problem is when I try to access my index.php I get a server error. when it's index.html I get a 403.
my selinux is currently enabled and no plans on disabling it. I would Like to learn how to use it rather. so it this an selinux problem?
As I run ls -Zla on /home/user/www/html, this is the result
-rw-r--r--. 1 root root unconfined_u:object_r:user_home_t:s0 27 Dec 21 22:37 index.php
It seems that SELinux is preventing this
when accessing an html
[Mon Dec 21 23:35:33.749916 2015] [core:error] [pid 20579] (13)Permission denied: [client 127.0.0.1:45632] AH00132: file permissions deny server access: /var/www/html/index.html
when a php
[Mon Dec 21 23:39:36.801672 2015] [:error] [pid 20585] [client 127.0.0.1:45816] PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
[Mon Dec 21 23:39:36.801730 2015] [:error] [pid 20585] [client 127.0.0.1:45816] PHP Fatal error: Unknown: Failed opening required '/var/www/html/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
~
to someone that may get this problem. change the selinux type of the folder using this command.
sudo chcon -R -t httpd_sys_content_t /home/user/www
more info
So I'm using Xampp on Linux to test some web pages and I'm facing an issue with loading images from the local file system onto the server
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
Now so far I've seen a lot of similar questions and I've edited the httpd.conf file accordingly as well as the directory to 'Project1_July2015' which is my folder for the project inside 'htdocs'
I've added the line 'Require all granted' as well and I still haven't found a solution to this.
The code uses ever possible combination of an image path I could come up with:
<img src="image1">
<img src="image1.jpg">
image1
<?php
$link1="img/1/image2";
$name="/image2";
$link="img";
?>
<img src="<?php echo $link;echo $name;?>">
<img src="<?php echo $link1;?>">
<img src="/opt/lampp/htdocs/Project1_July2015/image2">
So as you can see, I have 'image1' stored in the JPEG format in the folder /opt/lampp/htdocs/MyProject_2015 while 'image2'(also JPEG) is stored in a sub-folder in /img in the same path as 'image1'.
My httpd.conf file path is /opt/lampp/apache2/conf and its contents now resemble :
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"
<Directory "/opt/lampp/htdocs/">
Require all granted
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Is it the path to my directory that I'm messing up, the path to my image that is incorrect, or some other issue with my code?
This is how the error_log looks for the last couple of entries :
[Sun Oct 25 15:40:51.917516 2015] [core:error] [pid 4946] (13)Permission denied: [client 127.0.0.1:55332] AH00132: file permissions deny server access: /opt/lampp/htdocs/Project1_July2015/img/image1.jpg, referer: http://localhost/Project1_July2015/img/
This is all the entries in error_log since I restarted xampp in case that helps:
[Sun Oct 25 16:04:39.411323 2015] [mpm_prefork:notice] [pid 4540] AH00169: caught SIGTERM, shutting down
[Sun Oct 25 16:04:46.002063 2015] [ssl:warn] [pid 5513] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sun Oct 25 16:04:46.002277 2015] [ssl:warn] [pid 5513] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Oct 25 16:04:46.002695 2015] [suexec:notice] [pid 5513] AH01232: suEXEC mechanism enabled (wrapper: /opt/lampp/bin/suexec)
[Sun Oct 25 16:04:46.056649 2015] [auth_digest:notice] [pid 5514] AH01757: generating secret for digest authentication ...
[Sun Oct 25 16:04:47.002128 2015] [ssl:warn] [pid 5514] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sun Oct 25 16:04:47.002251 2015] [ssl:warn] [pid 5514] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Oct 25 16:04:47.002607 2015] [lbmethod_heartbeat:notice] [pid 5514] AH02282: No slotmem from mod_heartmonitor
[Sun Oct 25 16:04:47.016544 2015] [mpm_prefork:notice] [pid 5514] AH00163: Apache/2.4.12 (Unix) OpenSSL/1.0.1m PHP/5.6.8 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
[Sun Oct 25 16:04:47.016596 2015] [core:notice] [pid 5514] AH00094: Command line: '/opt/lampp/bin/httpd -E /opt/lampp/logs/error_log -D SSL -D PHP'
[Sun Oct 25 16:04:53.915959 2015] [core:error] [pid 5916] (13)Permission denied: [client 127.0.0.1:55552] AH00132: file permissions deny server access: /opt/lampp/htdocs/Project1_July2015/img/image1.jpg, referer: http://localhost/Project1_July2015/img/
sudo chown -R www-data:www-data /opt/lampp and editing the httpd.conf file to reflect
<VirtualHost *:80>
ServerName myhost
ServerAlias myhost.mydomain.com
DocumentRoot /opt/lampp/htdocs
<Directory "/opt/lampp/htdocs">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
LogLevel error
ErrorLog /opt/lampp/logs/default-http-error.log
CustomLog /opt/lampp/logs/default-http-access.log combined
instantly brought up the following errors on the page. It's not loading anymore :
Warning: session_start(): open(/opt/lampp/temp//sess_3kkj6u86hfagsndsp4hdkljct1, O_RDWR) failed: Permission denied (13) in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 2
New session start successful
3kkj6u86hfagsndsp4hdkljct1
127.0.0.1
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1017 Can't find file: './user_list/login_attempts.frm' (errno: 13 - Permission denied)' in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php:16 Stack trace: #0 /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php(16): PDOStatement->execute() #1 /opt/lampp/htdocs/Project1_July2015/index.php(2): include('/opt/lampp/htdo...') #2 {main} thrown in /opt/lampp/htdocs/Project1_July2015/verify_blacklisted.php on line 16
Warning: Unknown: open(/opt/lampp/temp//sess_3kkj6u86hfagsndsp4hdkljct1, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/lampp/temp/) in Unknown on line 0
IMPORTANT : So far what I didn't realize and wasn't brought to my notice either is that there are two httpd.conf files. One is in opt/lampp/apache2 /conf while the other one is in /opt/lampp/etc.
When it is suggested you edit the httpd.conf file please consider the one in /opt/lampp/etc to avoid facing issues that I faced and learnt about the hard way.
So after nearly crashing my system (purely my own mistakes), while trying to change permissions for owning the files I realized there's a simple solution to the above issue. You don't need to change ownership of the entire folder '/opt/lampp' as that may or may not cause issues (it did, for me), all you need is :
$ cd /opt/lampp/htdocs
$ whoami
This enables you to find out the owner of the folder htdocs which should be you but if it isn't simply run the command :
$ sudo chown -R www-data(rootusername):www-data(rootusername) *
Since you've already navigated to htdocs you can use ' * ' ; however, if you haven't, I'd recommend you use :
$ sudo chown -R www-data(rootusername):www-data(rootusername) /opt/lampp/htdocs
After a fresh install so far this is what worked out for me. I've lost my databases with the uninstallation so it'll be a while before I can corroborate whether the images part works or not but as for setting permissions so far this is what definitely allowed access instead of the usual 'Acces denied' message in case of different ownership of htdocs.
If even after this the images fail to load citing 'Access denied', then I suggest you navigate to the 'yourwebsite' folder in htdocs and manually change ownership for image files using the same version of the above command with *.jpg instead.
Edit: It doesn't seem to work, but now I've got issues with connecting phpmyadmin to the databases so it'll be a while before I can test it well.
SOLUTION : FINALLY SOLVED THE ISSUE
DO NOT use the 'chown' or 'chmod' command lightly. I've done that and trust me it is not a piece of cake to revert to the initial configuration after that. So I've had this problem for a while now and I finally figured out a solution to it although it's only to be used as a last resort:
sudo chmod -R 777 /opt/lampp/htdocs/path/to/image/folder
this basically gives you all permissions pertaining to all the images stored in that folder. Cheers!
In your apache2.conf, these lines should be in there:
<Directory "/">
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory "/usr/share">
AllowOverride None
Require all granted
</Directory>
<Directory "/opt/lampp">
AllowOverride All
Require all granted
</Directory>
and your httpd.conf or whichever should have these:
<VirtualHost *:80>
ServerName myhost
ServerAlias myhost.mydomain.com
DocumentRoot /opt/lampp/htdocs
<Directory "/opt/lampp/htdocs">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
LogLevel error
ErrorLog /opt/lampp/logs/default-http-error.log
CustomLog /opt/lampp/logs/default-http-access.log combined
</VirtualHost>
Be sure you create blank folder "logs" under /opt/lampp so it'd house your logs reports.
Then finally sudo chown -R www-data:www-data /opt/lampp.
This is updated as per Apache2.4+
i really need your help..
my websites ranking is now loosing because of this error, and i don't know how to fix this.. even my web hosting provider can't fix this.
when i fetch as google there's an error
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to
use an ErrorDocument to handle the request.
and also when i view my website via googlebot 2.1 using user agent switcher i got that error too, and when i test my sitemaps on webmaster tool, i got
General HTTP error: HTTP 403 error (Forbidden) HTTP Error: 403
and hope you guys help me..
this is my
.htaccess
BEGIN WordPress
RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}
!-d RewriteRule . /index.php [L]
END WordPress
this i my website: http://www.naruto-tv.info
all subdomain and other domain that i'm using right now had a same problem and hosted on same server. but i have one subdomain that hosted on other server and working fine.
i also already contacted my server provider but they can't fix it.
ERROR LOGS:
[Mon Apr 14 14:02:28 2014] [error] [client 66.249.77.159] client
denied by server configuration:
/home/markgelo/public_html/markgiver/403.shtml
[Mon Apr 14 14:02:28 2014] [error] [client 66.249.77.159] client
denied by server configuration:
/home/markgelo/public_html/markgiver/page
[Mon Apr 14 14:02:20 2014] [error] [client 199.21.148.45] client
denied by server configuration:
/home/markgelo/public_html/markgiver/403.shtml
[Mon Apr 14 14:02:20 2014] [error] [client 199.21.148.45] client
denied by server configuration:
/home/markgelo/public_html/markgiver/carimi-invasion-2013-itunes-aac-m4a-album
[Mon Apr 14 14:02:15 2014] [error] [client 66.249.74.183] client
denied by server configuration: /home/markgelo/public_html/403.shtml
[Mon Apr 14 14:02:15 2014] [error] [client 66.249.74.183] client
denied by server configuration: /home/markgelo/public_html/2013
[Mon Apr 14 14:02:07 2014] [error] [client 37.59.30.32] client denied
by server configuration:
/home/markgelo/public_html/markserves/403.shtml
[Mon Apr 14 14:02:07 2014] [error] [client 37.59.30.32] client denied
by server configuration: /home/markgelo/public_html/markserves/2013
[Mon Apr 14 14:02:06 2014] [error] [client 66.249.74.183] client
denied by server configuration: /home/markgelo/public_html/403.shtml
[Mon Apr 14 14:02:06 2014] [error] [client 66.249.74.183] client
denied by server configuration: /home/markgelo/public_html/tag
[Mon Apr 14 14:02:05 2014] [error] [client 142.4.208.99] client denied
by server configuration:
/home/markgelo/public_html/markgiver/403.shtml
[Mon Apr 14 14:02:05 2014] [error] [client 142.4.208.99] client denied
by server configuration: /home/markgelo/public_html/markgiver/2013
[Mon Apr 14 14:02:05 2014] [error] [client 66.249.77.99] client denied
by server configuration: /home/markgelo/public_html/android/403.shtml
[Mon Apr 14 14:02:05 2014] [error] [client 66.249.77.99] client denied
by server configuration: /home/markgelo/public_html/android/
[Mon Apr 14 14:02:05 2014] [error] [client 37.59.42.24] client denied
by server configuration:
/home/markgelo/public_html/markgiver/403.shtml
Seems that it is not .htaccess error as it seems that it is vhost settings problem generally. I you have purchased shared hosting then request you contact your service provided to resolve the issue for HTTP/1.1 403 Forbidden problem for bots.
There can be two reasons for the problem but you need Administrative access to server to resolve the issue:
First
First Reason is the directories hosted outside of the default /var/www/. Apache requires permissions to all the directories all the way up to the root of the file system where the site is hosted. In case using default location setting are automatically done and if the settings are default then this doesn't apply to you.
For example, you've got a development machine and your site's directory is:
/abc/home/mywebsite/
You may think you can get away with:
chgrp -R www-data /abc/home/mywebsite/
chmod -R 2750 /abc/home/mywebsite/
because this gives Apache permissions to access your site's directory? Well that's correct but it's not sufficient. Apache requires permissions all the way up the directory tree so what you need to do is:
chgrp -R www-data /abc/
chmod -R 2750 /abc/
Obviously I would not recommend giving access to Apache on a production server to a complete directory structure without analysing what's in that directory structure.
Second
Global Setting in the global directory setting in the httpd.conf or in the specific directory block in httpd-vhosts.conf:
Options Indexes FollowSymLinks Includes ExecCGI
By default, your global directory settings is (httpd.conf line ~188):
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
set the options to :
Options Indexes FollowSymLinks Includes ExecCGI
Finally, it should look like:
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
Let me know if the issue doesn't resolved.
Editing
Ok. So, the service Provider is not ready to Change setting as it is shared server. Then you must request him to change your hosting changes only through http-vhosts.conf as:
<VirtualHost *:80>
DocumentRoot "abc" #Your Server root directory
ServerName def #Your Website name.
<Directory "abc"> #Your Directory Changes
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This will only effect your hosting setting not the other web hosting provided on shared server. Request them to change this. Hoping that they would change these setting this time.
I am completely new to PHP and web servers. I have a test PHP file. When I run this in the terminal I can see that PHP is working "php /Users/Fryza/Sites/phptest.php"
When I type these into the web browser I get 403 Forbidden error:
http://localhost/~fryza/phptest.php
http://localhost/phptest.php
I have a file (/private/etc/apache2/users/fryza.conf) that has these contents:
<Directory "/Users/fryza/Sites/">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
My DocumentRoot in private/etc/apache2/httpd.conf is /Users/Fryza/Sites/
I also have this directory /Library/Webserver/Documents - I used to have this as the document root but it wasn't working in this location either.
I have read through a bunch of stack overflow posts but they are not working for me.
The apache server definitely is running. PHP is working. Just can't get the files to load in the browser.
I'm running Mountain Lion
I did the same tutorial as the guy here and am having the same problem:
403 Forbidden error when accessing localhost on Mac OS X10.8
This is the error log:
[Mon Oct 28 17:57:17 2013] [notice] caught SIGTERM, shutting down
[Mon Oct 28 17:57:17 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Oct 28 17:57:17 2013] [warn] module php5_module is already loaded, skipping
[Mon Oct 28 17:57:17 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Oct 28 17:57:17 2013] [notice] Digest: done
[Mon Oct 28 17:57:17 2013] [notice] Apache/2.2.24 (Unix) DAV/2 PHP/5.3.26 mod_ssl/2.2.24 OpenSSL/0.9.8y configured -- resuming normal operations
Access Log:
::1 - - [28/Oct/2013:18:05:38 -0700] "GET /~fryza/phptest.php HTTP/1.1" 403 220
If you are running skype, your localhost will not run because skype also use the port as localhost. but when you run localhost first before skype it will work.
but when skype run first, you must end task by pressing ctr+alt+del then task manager and select skype then end task..
but that's only for info..
the real deal here is how your localhost work..
try to do this.
click the icon of your wamp server on the right bottom of your computer..
then click Restart All Services..
And run your localhost.
That's all I know.. Im a newbie here.. tnx :)
I finally figured it out. I don't know WHY this worked - but it did.
I changed my fryza.conf file from:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
To:
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
Can someone explain why this worked?