virtual host settings for typo3 - apache

DocumentRoot "C:/xampp_7/htdocs/BackupForEdow/Eddddddddd"
<Directory C:/xampp_7/htdocs/BackupForEdow/Eddddddddd>
AllowOverride All
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond {REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
</Directory>
Is this correct for a typo3 project?
I am not able to access the frontend of typo3 but my backend works correctly. The front-end shows an internal server error.
Please help me to create the virtual host.

The vhost really does depend on other things: For example if you use the shipped .htaccess, you don't need the rewrite statements.
Copy the _.htaccess from the TYPO3 source to .htaccess in your document root for that.
About errors in general: As already recommended, look in the Apache (or php) error logs. Also look in the TYPO3 system log ("Log" in the Backend).
About the certificate error: You need to set up an SSL/TLS certificate if you want to be able to access your website via https://. This is not a TYPO3 specific thing. You may want to consult other resources, e.g. search on stackoverflow.
Perhaps this helps.
Also, check if you can load your webpage via http://
For ssl in general you need these things:
Create a signed certificate. Your hoster should be able to help you with that. If you are setting up your TYPO3 installation on your desktop PC, you can skip that part for now and override the error message in the browser. For a public website you should always setup your certificates correctly, though.
Make sure the Apache ssl modules are enabled. I don't know enough about Xampp to help you there.
Create and enable a vhost file for ssl / port 443. Look for an existing example ssl vhost files in the sites-available directory, e.g. default-ssl.conf or search for examples online
Having a not correct server name in the certificate should usually not lead to a 500 error. It should generate a warning in the browser.

Related

AWS - Apache application behind app load server not using SSL certificate

I have placed my instances behind an ALB that has an ACM provided SSL certificate configured with it. However, when I browse to the web page (that I have configured via Route53's alias record to the App Load Balancer), it says that my connection is not secure.
What am I doing wrong here? Do I need to configure Apache somehow?
I got help from the following site. Added the code below to an .htaccess file that I placed at the app root, i.e., /var/www/html.
Caveat: Be aware that even though my app was running behind a load balancer, .htaccess is disabled by default in EC2 as a security measure and therefore needs to be be enabled by editing etc/httpd/conf/httpd.conf, where you change AllowOverRide = None to AllowOverRide = All
Code for .htaccess:
# Begin force ssl
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://your-domain/$1 [R,L]
</IfModule>
Restart apache once you've got this in there. sudo service httpd restart.
If it still doesn't work, clear browser cache. If it doesn't work for www.your-domain.com, it is quite possible that you ordered the certificate for your-domain.com only. Make a new certificate (they are free), with both names added to it.

HTTP Post request to aws ec2 directory /opt/lampp/htdocs/donate/ denied

I am trying to make a post request to http://localhost/donate/payment.php".
It works fine when I run the application locally
However when I change the URL to
"http://ec2-xx-xxx-xx-xxx.ap-southeast-2.compute.amazonaws.com/opt/lampp/htdocs/donate/payment.php"
I get page not found error. I can guarantee that the file is present in the location.
I have tried several things like changing the permission of the the /opt file recursively to 777. Also tried changing the apache server port default port from 80.
I even tried placing a .htacces file inside the donate folder to access the server. the contents are
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteCond %{REQUEST_URI} !^/WebProjectFolder/
RewriteRule (.*) /WebProjectFolder/$1
All attempts have failed. Is there anything else I am missing here. I have installed bitnami parse server and I am able to access that by http in the browser. It is present in the folder /apps in the root folder.
Does AWS override any security permissions?
Assuming /opt/lampp/htdocs/is your document root, shouldn't the URL be http://ec2-xx-xxx-xx-xxx.ap-southeast-2.compute.amazonaws.com/donate/payment.php?
You might also want to verify a couple of things:
Make sure your security policy has its inbound port 80 open to the public (or where you'll be visiting from)
Assuming you're using Apache httpd, make sure it accepts connections on the external interface or all interfaces (e.g. Listen 80, Listen 0.0.0.0:80, etc)
First, if you actually get an error from your Apache server, the issue has nothing to do with AWS. If there were misconfigured security groups or NACL, you'd never reach port 80 (http).
Second, never ever chmod -R 777, not only can you break your app behavior, but also, especially with PHP, you just opened security risks. Yes, this doesn't matter until your instance becomes part of a botnet and starts sending spam.
At a glance, I would say your Apache configuration lacks something, like a VirtualHost "any":
# from https://httpd.apache.org/docs/2.4/vhosts/examples.html
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
It seems like your default location points to another directory, possibly the default one.

.htaccess file on localhost

I have a localhost on ubuntu 16. In the root localhost directory (/var/www/html/) i put this htaccess file.
AddDefaultCharset utf-8
RewriteEngine on
RewriteRule ^index?$ index.php
When I type localhost/index apache says me
The requested URL /index was not found on this server.
Is that an error in Apache configuration?
Basicly I want to make redirects to index.php in the root of my site and here I want to parse something like this localhost/cart/item/1 to array and then realize MVC. I am new in web dev and do not realy understand how can I do it, please help me.
You have to enable the interpretation of such dynamic configuration files (".htaccess" style files) first. They are disabled by default, since they slow down the server considerably. Usually it is preferable to place such rules directly in the servers static configuration files.
To enable them take a look at the AllowOverride command: https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
<Directory "/var/www/html">
AllowOverride All
</Directory>
So since you have to modify that configuration anyway... why don't you place your rewrite rules in there too? Easier, more robust and faster too...
Apart from that it sometimes is a good idea to implement rewrite rules in such way that they work in both locations, the http servers (virtual) host configuration and dynamic configuration files:
RewriteEngine on
RewriteRule ^/?index/?$ index.php [L]
And a general hint: you should always prefer to place such rules inside the http servers host configuration instead of using dynamic configuration files (".htaccess"). Those files are notoriously error prone, hard to debug and they really slow down the server. They are only provided as a last option for situations where you do not have control over the host configuration (read: really cheap hosting service providers) or if you have an application that relies on writing its own rewrite rules (which is an obvious security nightmare).
Maybe you need to create a folder, and then, work in your application inside there. Ex:
Create a var/www/html/project;
Put yout .htaccess inside;
Work with your application inside that folder.

How to configure phabricator with a bare domain url?

I'm trying to run phabricator on my home server. The last thing I struggle with is to use phabricator with a bare url. I've set up a virtual host (apache 2.4) using a seperate port for phabricator and added the required rewrite rules:
<VirtualHost *:81>
DocumentRoot /var/www/html/phabricator/phabricator/webroot
RewriteEngine on
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
<Directory "/var/www/html/phabricator/phabricator/webroot">
Require all granted
</Directory>
</VirtualHost>
Unfortunately, phabricator demands a non-root url. Any ideas?
I get the following error message:
User moodboom found a solution but did not post the answer at how-to-configure-phabricator-with-a-non-root-url.
It doesn't look like it demands a non-root URL from the post you pointed to. It looks like the reverse, it demands a root URL. As quoted in the answer you mentioned:
You can either install Phabricator on a subdomain (like
phabricator.example.com) or an entire domain, but you can not install
it in some subdirectory of an existing website.
Since there wasn't any easy way to solve this, I hat to set up a local DNS server (dnsmasq) to get rid of this problem. Manually changing the host file on every single client is possible but too tedious and error prone. Dnsmasq on the other hand was easy to setup on ubuntu 16.04 and will keep my local network a bit more organized.
Cheers,
O.Schmitz

What is .htaccess file?

I am a beginner to Zend framework and I want to know more about the .htaccess file and its uses. Can somebody help me?
I found an example like this:
.htacess file
AuthName "Member's Area Name"
AuthUserFile /path/to/password/file/.htpasswd
AuthType Basic
require valid-user
ErrorDocument 401 /error_pages/401.html
AddHandler server-parsed .html
It's not part of PHP; it's part of Apache.
http://httpd.apache.org/docs/2.2/howto/htaccess.html
.htaccess files provide a way to make configuration changes on a per-directory basis.
Essentially, it allows you to take directives that would normally be put in Apache's main configuration files, and put them in a directory-specific configuration file instead. They're mostly used in cases where you don't have access to the main configuration files (e.g. a shared host).
.htaccess is a configuration file for use on web servers running the
Apache Web Server software.
When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software.
These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer.
These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention.
Whenever any request is sent to the server it always passes through .htaccess file. There are some rules are defined to instruct the working.
Below are some usage of htaccess files in server:
1) AUTHORIZATION, AUTHENTICATION: .htaccess files are often used to specify the security restrictions for the particular directory, hence the filename "access". The .htaccess file is often accompanied by an .htpasswd file which stores valid usernames and their passwords.
2) CUSTOMIZED ERROR RESPONSES: Changing the page that is shown when a server-side error occurs, for example HTTP 404 Not Found.
Example : ErrorDocument 404 /notfound.html
3) REWRITING URLS: Servers often use .htaccess to rewrite "ugly" URLs to shorter and prettier ones.
4) CACHE CONTROL: .htaccess files allow a server to control User agent caching used by web browsers to reduce bandwidth usage, server load, and perceived lag.
More info : http://en.wikipedia.org/wiki/Htaccess
You are allow to use php_value to change php setting in .htaccess file. Same like how php.ini did.
Example:
php_value date.timezone Asia/Kuala_Lumpur
For other php setting, please read http://www.php.net/manual/en/ini.list.php
Htaccess is a configuration file of apache which is used to make changes in the configuration on a directory basis.
Htaccess file is used to do changes in functions and features of the apache server.
Htaccess is used to rewrite the URL.
It is used to make site address protected.
Also to restrict IP addresses so on particular IP address site will not be opened
You can think it like php.ini files sub files.. php.ini file stores most of the configuration about php like curl enable disable. Where .htaccess makes this setting only for perticular directory and php.ini file store settings for its server' all directory...
It is not so easy to give out specific addresses to people say for a conference or a specific project or product.
It could be more secure to prevent hacking such as SQL injection attacks etc.
.htaccess file create in directory /var/www/html/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
What
A settings file for the server
Cannot be accessed by end-user
There is no need to reboot the server, changes work immediately
It might serve as a bridge between your code and server
We can do
URL rewriting
Custom error pages
Caching
Redirections
Blocking ip's