Issue with httpd. unable to view any files on folder - http

I have a created file serving tool using http. it was working without any issue. I did recently upgraded to httpd services. post that not able view/open any files.
my http.conf
ServerRoot "/etc/httpd"
Include conf.modules.d/*.conf
User apache
Group apache
<VirtualHost *:443>
SSLEngine on
SSLProtocol -ALL -SSLv3 +TLSv1.2
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLCertificateFile /etc/pki/tls/certs/tool.crt
SSLCertificateKeyFile /etc/pki/tls/private/tool.key
SSLCertificateChainFile /etc/pki/tls/certs/tool.crt
Servername 10.x.x.x
</VirtualHost>
ServerAdmin root#localhost
DocumentRoot "/opt"
<Directory "/opt">
AllowOverride None
Require all granted
</Directory>
<Directory "/opt/tool">
Options Indexes FollowSymLinks
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
my error:
[Mon Apr 25 22:42:04.696565 2022] [mime_magic:error] [pid 16538] (13)Permission denied: [client 10.x.x.x:53639] AH01513: mod_mime_magic: read failed: /opt/Backup/2022/Apr/25/device.config
not sure, how to fix this issue.
my finding,
1.when give permission 751 to files, i am able to see but unable to open it getting some error.
error
Forbidden
You don't have permission to access /tool/2022/Apr/25/device.config on this server.
2.when i create files extension with .txt able to see but able to open not able to see any content. getting below
<!DOCTYPE HTML PUBLIC "-//IETF//DTD
am not from dev background. need some help here.

Related

Why am I suddenly recieving Access Forbidden Error 403 when trying to access localhost/phpmyadmin?

I use xampp to develope my Wordpress sites, 3 months ago I set up a project and accessed localhost/phpmyadmin with no issues and have been working on the project since. However yesterday I tried to set up a new project and access localhost/phpmyadmin and I recieved:
403 Error page: "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."
I haven't updated xampp or changed anything since 3 months ago and my other wordpress project is working perfectly, no database issues.
I just can't access localhost/phpmyadmin.
I'm using Apache/2.4.37 (Win32), PHP/7.3.0, OpenSSL/1.1.1a, XAMPP Control Panel v3.2.2
I've tried editing C:/xampp/apache/conf/extra/httpd-xampp.conf and replacing "require local" with both "request all garunteed" and "require all granted" inside but neither worked.
I've read lots of other threads but everyone's httpd-xampp.conf file contains a LocationMatch tag, which mine does not.
Here is my httpd-xampp.conf file:
#
# XAMPP settings
#
<IfModule env_module>
SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
SetEnv MYSQL_HOME "\\xampp\\mysql\\bin"
SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
SetEnv PHP_PEAR_SYSCONF_DIR "\\xampp\\php"
SetEnv PHPRC "\\xampp\\php"
SetEnv TMP "\\xampp\\tmp"
</IfModule>
#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
#
# PHP-CGI setup
#
#<FilesMatch "\.php$">
# SetHandler application/x-httpd-php-cgi
#</FilesMatch>
#<IfModule actions_module>
# Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</IfModule>
<IfModule php7_module>
PHPINIDir "C:/xampp/php"
</IfModule>
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
</Directory>
<Directory "C:/xampp/cgi-bin">
<FilesMatch "\.php$">
SetHandler cgi-script
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler None
</FilesMatch>
</Directory>
<Directory "C:/xampp/htdocs/xampp">
<IfModule php7_module>
<Files "status.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
</Directory>
<IfModule alias_module>
Alias /licenses "C:/xampp/licenses/"
<Directory "C:/xampp/licenses">
Options +Indexes
<IfModule autoindex_color_module>
DirectoryIndexTextColor "#000000"
DirectoryIndexBGColor "#f8e8a0"
DirectoryIndexLinkColor "#bb3902"
DirectoryIndexVLinkColor "#bb3902"
DirectoryIndexALinkColor "#bb3902"
</IfModule>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp/webalizer">
<IfModule php7_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
</IfModule>
You might try checking permissions on "C:/xampp/phpMyAdmin/". Maybe you accidentally changed them / owner.
Good luck.
I found the solution and it had nothing to do with my configurations. For some reason my phpmyadmin folder had been moved out of C:/xampp into C:/Data.
No idea how, possibly Windows update?
Anyway, I found this by going to the XAMPP Control Panel > Apache > Config > phpMyAdmin and when I clicked on it; it said it could not find the file in C:/xampp/phpmyadmin.
I then searched my computer for phpmyadmin and found it in C:/Data. Cut and pasted it into C:/xampp and voila! Everything works perfectly.
image of xampp control panel showing steps

Wordpress Permalink settings not working with apache on ubuntu 16.04 - getting site not found error

I know this question has been asked so many times. However, I had to post this since I have followed all of the posts and still getting this error.
I want to change my permalink settings with post name like http://www.example.com/sample-post. when I change that in the wordpress admin (settings/permalink) and save changes, I get page not found for any of my pages.
I see that wordpress has access to .htaccess file on the main folder since i removed it once and it got created when I restart my permalink settings in wordpress admin. (settings/permalink)
below is my etc/apache2/apache2.conf
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
AccessFileName .htaccess
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
Thanks so much for reading this long post and helping a friend! And, please let me know if you have any questions.
I found a fix.
sudo a2enmod rewrite

Cache-control max-age setting using .htaccess

This is my http.confg file:
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
Include /etc/phpmyadmin/apache.conf
This is my .htaccess file:
<FilesMatch "\.(xml)$">
Header unset ETag
FileETag None
Header set Cache-Control "max-age= 300, public"
</FilesMatch>
This is the link I'm experimenting on : `
http://ec2-54-226-158-192.compute-1.amazonaws.com/LiveTV.xml
(1) When I first direct to this link on Mozilla Firefox,
this is what I listen on the server side:
and this is what I gather on the client side, using wire-shark.
(2) Now I send the request again:
this is what I listen on the server side:
and this is what I gather on the client side, using wire-shark.
(3) When the max-age expires, I send the request again:
this is what I listen on the server side:
and this is what I gather on the client side, using wire-shark.
My Questions over here are :
Why am I getting Cache-Control: max-age=0 on the server side ?
Shouldn't I get 200 response after the max-age expires? Why am I getting 304 status code on the first request after max-age expires?

centos httpd.conf multiple subdomain different location

This has probably been answered but I can't find a straight answer, or the ones I found don't work.
I have one domain, let's call it mydomain.com The DNS settings point two subdomains. These are staging.mydomain.com and mydomain.com. Both have an A-record pointing to same IP, lets say 8.8.8.8.
On the server (8.8.8.8) I have httpd.conf with two virtual hosts, which already create by cpanel. These are as follows:
mydomain.com
<VirtualHost 8.8.8.8:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /home/userxxx/public_html
## User ydg015 # Needed for Cpanel::ApacheConf
<IfModule mod_suphp.c>
suPHP_UserGroup userxxx userxxx
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup userxxx userxxx
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid userxxx userxxx
</IfModule>
CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
CustomLog /usr/local/apache/domlogs/mydomain.com combined
# ScriptAlias /cgi-bin/ /home/userxxx/public_html/cgi-bin/
</VirtualHost>
And...
staging.mydomain.com
<VirtualHost 8.8.8.8:80>
ServerName staging.mydomain.com
ServerAlias *.staging.mydomain.com
DocumentRoot /home/userxxx/public_html/staging
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/staging.mydomain.com combined
CustomLog /usr/local/apache/domlogs/staging.mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User ydg015 # Needed for Cpanel::ApacheConf
<IfModule mod_suphp.c>
suPHP_UserGroup userxxx userxxx
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup userxxx userxxx
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid userxxx userxxx
</IfModule>
# ScriptAlias /cgi-bin/ /home/userxxx/public_html/staging/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/userxxx/staging.mydomain.com/*.conf"
</VirtualHost>
The problem is:
I'm using wordpress multiple site to build both site (staging and main), and the multisite provide another subdomain like http://en.mydomain.com and http://en.staging.mydomain.com
Everytime I go to en.mydomain.com or en.staging.mydomain.com, I always land on "cgi-sys/defaultwebpage.cgi" someone told me, maybe I should make a change on the http.conf, but I don't know what should I change.
can anybody help me to fix this?
Any suggestions would be so appreciated. Thanks you!
The code given in these two virtual hosts are fine, but there could be another configuration in which might causing this behavior.
You should use following command to identify the correct document root.
httpd -t -D DUMP_VHOSTS
Note: httpd needs to be replaced with correct executable for your environment, for example apache2 or apachectl
Share the output of this command in case if you still not able to understand the issue.

Wordpress Apache Config Errors

I have installed Wordpress on Apache. It appears to work fine, i get the homepage and have created pages on the admin.
I can access the home[page fine. But when i try access the pages. I get 404s.
http://mysite.com/ works fine
http://mysite.com/news throughs a 404.
In the log files, I have the following error:
[Fri Dec 14 10:21:58 2012] [error] [client 127.0.0.1] File does not exist: /home/wordpress/mysite/news, referer: http://mysite.com/
I am using NameBasedVirtual hosting in Apache.
<VirtualHost *:8080>
ServerName mysite.com
DocumentRoot /home/wordpress/mysite/
ErrorLog /var/log/www/mysite-error.log
CustomLog /var/log/www/mysite-access.log combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<Directory /home/wordpress/mysite>
AllowOverride FileInfo Options
Allow from all
DirectoryIndex index.php
</Directory>
<Location /wp-admin/>
Header set Cache-Control no-cache
</Location>
</VirtualHost>
I looked at .htaccess.
It says .
But Apache doesnt have mod_rewrite installed by default on Ubuntu. So it didnt work and didnt through a nice error.
Just add in mod_rewrite to fix this

Resources