Apache2 configuration issue - Avoid file accessing without extension - apache2

I'm developing a website and having development environment as Ubuntu 14.04, PHP 5.5.9, Apache 2.4.7. My issue is if some want accessing a file like http://domain.com/robots(without extension) then I should avoid but I've to allow if some tries to access http://domain.com/robots.txt(with extension).
Now in both ways I'm able to access files, I want to avoid this when user haven't given extension of the file using .htaccess or apache configuration file.
My previous environment was Apache 2.2 and PHP 5.3.10 at the time with default Apache configuration it was working as expected but after upgrade its not working as expected and due lack of knowledge on Apache configuration I'm unable to pick those lines of code.

Add following line in .htaccess
Options -Multiviews

Related

cakePHP application install

H!
I'm new to cakePHP I have have a cakePHP application . I got from
https://github.com/OldWest/CakePHP-1.3-MEIO-image-upload-sample-code
I want to install this in my wamp server. PHP version:5.4.16
I am getting 3 errors
1.Warning: include(cake\bootstrap.php): failed to open stream: No such file or directory in D:\wamp\www\cake\webroot\index.php on line 76
2.Warning: include(): Failed opening 'cake\bootstrap.php' for inclusion (include_path='E:\wamp\www_cake\cakephp-cakephp-1.3.2-38-g8581350\cakephp-cakephp-8581350;D:\wamp\www\cake\;.;C:\php\pear') in D:\wamp\www\cake\webroot\index.php on line 76
3.Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your \cake core directory and your \vendors root directory. in D:\wamp\www\cake\webroot\index.php on line 77
How Can i use the same cakePHP folder used for Blog application in tutorials
I mean multiple application with same cakePHP library How?
Don't use version 1.3. it is an old version.
Use the latest. https://github.com/cakephp/cakephp/releases/tag/2.4.6
The old versions will get you in trouble (as a beginner) with new php versions.
Also, the framework had evolved greatly since 1.3.
Not new to either php or programming here, but I too am saddled with a cake 1.3 site that must be yanked along to work with newer code. Telling people to just upgrade is not helpful.
I looked in the 'advanced configuration' section here https://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Installation.html
and by examining the current index.php found that my existing installation was expecting the core cake files to be elsewhere entirely on the system. You could then either plunk the core files where expected, or change the configuration in index.php, depending on current practices.

Apache 2.4.6 and Apache Tomcat 7.0.42 on Port 80

On my Ubuntu 13.10 I have installed Apache and Tomcat. I am trying to get tomcat to work on port 80 with no luck at all. I have looked at using mod_jk following several online tutorials with no success. What I am trying to achieve is I have a webapp on tomcat running as the root application. Therefore the current url is www.example.com:8080. I also have apache which is on the url www.example.com. I want to be able to access files on the apache webserver for e.g www.example.com/somefile but also have my webapp running at the sametime on www.example.com. Please can anyone help.
You need to add url redirection to apache and check for the path in apache httpd.conf.
Check the path of the incoming request is just example.com then you rewrite it to example.com:8080.
The mod_proxy of apache should be able to do this for you.
http://tomcat.apache.org/tomcat-4.1-doc/proxy-howto.html
Apache Tomcat by default runs on port 8080. Incase if you need to run it in port 80 you need to use JSVC which comes along with tomcat. If you have installed tomcat by downloading the binary version then jsvc will be available under
[tomcat_install_path]/bin/commons-daemon-native.tar.gz
you need to untar it and compile it. Compiling it is easy.
# ./configure
# make
once you have compiled it you will get the jsvc binary file which needs to be placed under the tomcat bin directory.
Then to start up tomcat with the help of jsvc follow the steps mentioned here
JSVC is the officially recommended way of starting Tomcat in port 80.
So I managed to solve this problem by Using Mod_Proxy. Editing the 000-Deafult.conf file in /etc/apache2/sites-enabled and adding the following lines:
ProxyPass /SomeUrl !
ProxyPass / http://localhost:8080/
The first line indicates what you don't want to proxy and the second one indicates what to proxy.In this case forward the ROOT app of Tomcat at port 8080 to the root of the Apache web server
Also edited the server.xml file in /etc/tomcat7 and added the following
<Connector port="8080" protocol="AJP/1.3" proxyName="www.mydomain.com" proxyPort="80"/>

Grails MS SQLServer 2008 jdbc driver causes problems in tomcat

What is the official way to use the microsoft jdbc driver for mssql in a grails application?
The general opinion that I found through googling is that I only have to drop the jar in the lib directory of the grails app. This works if I do a grails clean and grails compile --refresh-dependencies. But when I deploy on a real server I have two problems.
When redeploying there is this a warning in the logs.
24.05.2013 16:03:03 com.microsoft.sqlserver.jdbc.AuthenticationJNI
WARNUNG: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
I'm not sure if its something to care about since its a warning. But I would like to have my logs clean and I have the dll in the lib directory of the application just as google is saying. Additionally on redeployment there are several messages like this that might relate to the first one:
24.05.2013 16:03:02 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SCHWERWIEGEND: A web application created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal#76fe8d1b]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
And the last thing is that my coworker said, that she thinks the driver should not be installed on a per application basis but directly into tomcat. I actually don't know how to do this, but if I did it, this would cause a problem on the development machine since I don't know how to get grails run-app going without the driver in the applications lib directory.
You can still place the library in the lib folder of your project and just exclude this from the war generation.
You don't need to exclude the jar everytime you build your project, just follow this post tip.
In your Tomcat server the jar will be placed in the shared lib folder instead of each web application.
If after that you still get the warning about sqljdbc_auth.dll you will need to locate this file and add the folder in the Tomcat classpath (or copy to Tomcat lib folder).

NoClassDefFoundError MimeTypeException with PDF extraction

I am getting an exception trying to use update/extract with PDF files
My Set up is:-
Ubuntu Server 11.10
Tomcat 6
Solr 3.5.0.2011.11.22.15.54.38
I can browse to solr/admin OK
I have put all the contrib/extract and apache-solr-cell3.5.0.jar libraries into the tomcat folder webapps/solr/WEB-INF/lib
I am calling extract using:-
curl "http://localhost:8080/solr/update/extract?uprefix=attr_&fmap.content=attr_content&commit=true" -F "file=/path/to/my.pdf"
error is
java.lang.NoClassDefFoundError: org/apache/tika/mime/MimeTypeException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:383)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425)
at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:461)
at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.getWrappedHandler(RequestHandlers.java:248)
at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:239)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1372)
Would appreciate any pointers - the only time this error seems to come up elsewhere is with Nutch and cached results.
I have tried sending the mimetype in the querystring and also a *.doc file but got the same error.
According to the error message it is not a MimeTypeException exception you get: The problem is a NoClassDefFoundError, because Solr cannot load the class MimeTypeException.
Normally this class is present in tika-core.jar.
Make sure you actually have that file and also check if you have a lib statement in your solrconfig.xml pointing to the right directory.
This was due to the basic error of copying the necessary tika libraries (to tomcat6/webapps/solr/WEB-INF/lib) but leaving ownership of the jar files as ROOT instead of chown-ing them to TOMCAT6. After setting the right permission and restarting Tomcat it started working OK
Found the solution of this problem, I was using SolrJ to update my pdf indexing.
after deploy solr to tomcat, I didn't include the following libraries into the tomcat/webapp
and I get all the lazy loading problem, etc etc
I even try to get apache tika...
until I do this...
shutdown tomcat
\apache-solr-3.5.0\contrib\extraction
copy the libraries above to below
\apache-tomcat-7.0.26\webapps\solr\WEB-INF\lib
startup tomcat
cheers

Ushahidi No Input File Specified

I have been trying to install Ushahidi platform for weeks but without any luck. I recently started over using Ushahidi latest release ushahidi-Ushahidi_Web-2.0.1-140-g0991172.zip and extracted it to folder ushahidi under my root.
I am using godaddy Linux server. I have tried both the manual and wizard to setup Ushahidi. In all cases, after installation, I get the same error when I try to access admin page. The error reads:
No input file specified.
I have tried tried installing using the wizard and the manual process. My PHP version is as required.
Any help will be appreciated. I need it to work so I can move on and customize it. Very disappointing such a good open source tool has poor installation guides!
Thanks.
Sting
there are a few things that can trip up following the installation.
Make sure that:
mod_rewrite is turned on in apache "a2enmod rewrite"
AllowOverride All is set in your apache config for your site (/etc/apache2/sites-available/default)
your .htaccess file points to the correct webroot

Resources