apache

htaccess - how to apply RegEx patterns on the output of another - encapsulation

无人久伴 提交于 2021-02-10 15:44:24
问题 I'm performing several regular expressions on a string inside a variable in order to clean it up for further use in the htaccess rules, but it seems rather cumbersome to do such simple thing in several lines: RewriteCond %{THE_REQUEST} (?<=\s)(.*?)(?=\s) RewriteRule ^(.*)$ - [E=HREFPATH:%1] RewriteCond %{ENV:HREFPATH} (^.*)?\? RewriteRule ^(.*)$ - [E=HREFPATH:%1] RewriteCond %{ENV:HREFPATH} /(.*) RewriteRule ^(.*)$ - [E=HREFPATH:%1] RewriteCond %{ENV:HREFPATH} (.*)/$ RewriteRule ^(.*)$ - [E

Apache virtual host on different ports doesn't work

試著忘記壹切 提交于 2021-02-10 14:36:18
问题 I'm trying to serve different folders on my localhost. I'm using Windows OS. I want to serve E:/Programming/Projects on localhost:8080 , and E:/htdocs on localhost:80 My httpd-vhosts.conf file is like that: Listen 8080 <VirtualHost *:8080> ServerName localhost DocumentRoot "E:/Programming/Projects" <Directory "E:/Programming/Projects"> AllowOverride All </Directory> </VirtualHost> When I attempt to navigate localhost:80, this port works well. But localhost:8080 gives this error: 403 -

Apache responses with http/1.0 even if request is http/1.1

落花浮王杯 提交于 2021-02-10 14:23:03
问题 I configured Apache Http server version 2.4 as proxy for backend server (Glassfish App Server actually). MPM is worker . Configuration is mostly default. Configuration for proxy ProxyPass /context/ http://backend.com:8080/context/ keepalive=On ttl=25 timeout=300 max=50 ProxyPassReverse /context/ http://backend.com:8080/context/ I open page in browser and it sends GET http://example.com/context HTTP/1.1 to Apache. Apache returns response HTTP/1.0 200 OK with Connection: close header. But

Adding a host to hosts file [closed]

二次信任 提交于 2021-02-10 13:20:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 years ago . Improve this question I'm trying to learn about hosts & apache a little bit. One of the things I'm trying to do myself is to add a line to /etc/hosts so that way I can access localhost in the browser Currently, hosts contains this: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0

为什么选择PHP作为后台语言

℡╲_俬逩灬. 提交于 2021-02-10 11:23:00
越来越多的企业使用PHP+MYSQL搭建网站,究竟PHP有什么好,为什么要选择用PHP? 1. 跨平台,性能优越,跟Linux/Unix结合别跟Windows结合性能强45%,并且和很多免费的平台结合非常省钱,比如LAMP (Linux/Apache/Mysql/PHP)或者FAMP(FreeBSD/Apache/Mysql/PHP)结合,或者数据应用够大可以考虑换 PostgreSQL或者Oracle,支持N种数据库。(N >= 10) 2. 语法简单,如果有学习C和Perl的很容易上手,并且跟ASP有部分类似。有成熟的开发工具,比如NuPHPed,或者Zend Studio等等,再Linux平台下可以使用Eclipse等等。 3. 目前主流技术都支持,比如WebService、Ajax、XML等等,足够应用。 4. 有比较完整的支持,比如使用ADODB或者PEAR::DB做数据库抽象层,用Smarty或者smart template做模板层,如果是PHP 5.1的话,还能够使用PDO(PHP Data Object)来访问数据库。 5. 有很成熟的框架,比支持MVC的框架:phpMVC,支持类似ASP.net的事件驱动的框架:Prado,支持类似Ruby On Rails的快速开发的框架:Cake等等,足够满足你的应用需求。 PHP 6. PHP 5已经有成熟的面向对象体系

Directing Non-Slash URL to Slash

☆樱花仙子☆ 提交于 2021-02-10 11:12:14
问题 When I enter the website.com/seo link, I want to make a 301 redirect to the website.com/seo/ link. However, I don't want it to be broken in the codes I wrote in the current htaccess. my htacces codes: RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L] 回答1: Use only one of these, do not use together! Try: RewriteEngine

Directing Non-Slash URL to Slash

北战南征 提交于 2021-02-10 11:03:29
问题 When I enter the website.com/seo link, I want to make a 301 redirect to the website.com/seo/ link. However, I don't want it to be broken in the codes I wrote in the current htaccess. my htacces codes: RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L] 回答1: Use only one of these, do not use together! Try: RewriteEngine

Protecting certain files and folders from view within a public folder

≡放荡痞女 提交于 2021-02-10 10:18:08
问题 Today I've been struggling with this for a while. What I am trying to accomplish is that I need to block all users from acessing a certain php files and images and more things (they are in a separate folder). I am using WAMP-server. I do not want the users to be able to go to just that site, like "www/images/crazy-cat-picture.jpg" (or more like "www/phpScripts/sign-up-user.php") but I still want the users ta be able to see the pictures on my website and call the php scripts. I tried 3

linux安装ActiveMQ

纵饮孤独 提交于 2021-02-10 09:54:28
linux: 准备工作 :安装JDK7以上. https://www.cnblogs.com/Dylansuns/p/6974272.html 1. 下载 cd /home/download wget https://archive.apache.org/dist/activemq/5.14.0/apache-activemq-5.14.0-bin.tar.gz 2. 创建安装目录 mkdir /usr/local/activemq 3. 解压文件 tar -zxvf  apache-activemq-5.14.0-bin.tar.gz -C /usr/local/activemq 4. 启动服务 cd /usr/local/activemq/apache-activemq-5.14.0/bin/linux-x86-64 chmod 755 activemq ./activemq start 三种运行方式: (1)普通启动 ./activemq start 停止 ./activemq stop (2)启动并指定日志文件 ./activemq start >tmp/smlog (3)后台启动方式nohup ./activemq start >/tmp/smlog 前两种方式下在命令行窗口关闭时或者ctrl+c时导致进程退出,采用后台启动方式则可以避免这种情况 执行 ./bin

大型网站如何防止崩溃,解决高并发带来的问题

℡╲_俬逩灬. 提交于 2021-02-10 08:43:19
大型网站,比如门户网站,在面对大量用户访问、高并发请求方面带来的问题 1大并发:在同一个时间点,有大量的客户来访问我们的网站,如果访问量过大,就可能造成网站瘫痪。 2大流量:当网站大后,有大量的图片,视频, 这样就会对流量要求高,需要更多更大的带宽。 3大存储:你的数据量会成海量的数据,如果我们的数据放入一张表,是无法应对的。可能对数据保存和查询出现问题。 基本的解决方案集中在这样几个环节:使用高性能的服务器、高性能的数据库、高效率的编程语言、还有高性能的Web容器,(对架构分层+负载均衡+集群)这几个解决思路在一定程度上意味着更大的投入。 解决方案: 一、提高硬件能力、增加系统服务器。(当服务器增加到某个程度的时候系统所能提供的并发访问量几乎不变,所以不能根本解决问题) 二、使用缓存(本地缓存:本地可以使用JDK自带的 Map、Guava Cache.分布式缓存:Redis、Memcache.本地缓存不适用于提高系统并发量,一般是用处用在程序中。比如Spring是如何实现单例的呢?大家如果看过源码的话,应该知道,Spiring把已经初始过的变量放在一个Map中,下次再要使用这个变量的时候,先判断Map中有没有,这也就是系统中常见的单例模式的实现。) 分布式缓存利器Redis集群,Redis集群的搭建至少需要三主三从。 1. 所有的redis节点彼此互联(PING-PONG机制)