Apache - Migracion de una web con apache v2.2 a v2.4

 
Vista:
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 28/05/2018 22:22:06
Hola a todos,

Soy nuevo en el foro y quisiera hacer algunas consultas al respecto sobre un inconveniente que estoy teniendo al migrar una pagina web que tengo actualmente en un entorno de producción, me encomendaron migrarla a un servidor con Red Hat Enterprise Linux 7 (la pagina actual esta corriendo sobre un CenOS 6). Lo que hice fue lo siguiente:

- Instale con YUM el Apache 2.4.6 en el servidor nuevo con Red Hat Linux 7, el cual viene por defecto en RHEL 7
- Con el comando rsync copie el sitio desde el servidor productivo al nuevo.
- configure los parametros del archivo httpd.conf que pide apache en su documentación
- Levante apache.

A continuación les muestro la configuración que hice, siguiendo la configuración que tengo en el servidor productivo.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
ServerAdmin root@10.24.0.168
 
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
ServerName 10.24.0.168:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>
 
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/"

#
# Relax access to content within /var/www.
#
<Directory "/var/www/">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/var/www">
<Directory "/var/www">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
 
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
 
    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
 
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html index.xhtml
</IfModule>
 
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all denied
</Files>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    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>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    #CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar
 #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar
 
    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
 
    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
 
</IfModule>
 
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig /etc/mime.types
 
    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
 
    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi
 
    # For type maps (negotiated resources):
    #AddHandler type-map var
 
    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset UTF-8
 
<IfModule mime_magic_module>
    #
    # The mod_mime_magic module allows the server to use various hints from the
    # contents of the file itself to determine its type.  The MIMEMagicFile
    # directive tells the module where the hint definitions are located.
    #
    MIMEMagicFile conf/magic
</IfModule>
 
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
 
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults if commented: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
EnableSendfile on
 
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf


Luego de esta configuración reinicie Apache, y al consultar la pagina nuevamente me arroja lo siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
 
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
 
$configFile = realpath(dirname(__FILE__) . '/../../..') . '/private/Cetelem.config';
require($configFile);
//die($configFile);
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../../library'),
    get_include_path(),
)));
 
/** Zend_Application */
require_once 'Zend/Application.php';
 
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
 
$application->bootstrap()
            ->run();

Agradezco puedan ayudarme
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 103
Oro
Ha mantenido su posición en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por xve (284 intervenciones) el 29/05/2018 07:35:09
Hola Jose, entiendo por lo que comentas, que el servidor Apache, no tiene las librerías de PHP, ya que si te muestra el código PHP en pantalla, es porque no lo sabes interpretar!!

Revisa la linea 46 y 47... las tienes repetidas!!!

No se si puede ser por esto... coméntanos, ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 29/05/2018 22:07:30
hola xve,

Muchas gracias por la ayuda, la lineas repetidas que ves en la linea 42 y 43 fue un error mio al copiar y pegar. Con respecto al codigo PHP que me aparece, esto me aparece cuando voy a consultar agregando la IP, y el path donde esta el index.php (perdón por no aclarar este punto antes).
Ahora bien, yo tengo configurado el httpd.conf del apache 2.4 con la IP del servidor donde migre la pagina, para poder ingresar al sitio por IP, al consultar la IP en cualquier navegador, me arroja ahora el siguiente mensaje:

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.

Estuve leyendo algunos tutoriales al respecto de este mensaje, y algunos mencionan que se resuelve agregando este parametro en la versión de apache que menciono yo "Require all granted".

Otros tutoriales mencionan que se puede deber a algún cambio en el .htaccess (el mismo no sufrio ningún cambio).

Otros también ponen como solución dar permisos recursivos al path donde esta las paginas, y digo donde están las paginas, ya que son varias paginas, por ejemplo en el servidor de producción el sitio esta de la siguiente manera, en el /var/www/ hay varios directorios, entre ellas la pagina que quiero levantar, y otras paginas que son invocadas con httpd-vhost

Gracias nuevamente

Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 01/06/2018 19:25:05
Alguien que tenga una idea cual puede ser el inconveniente.

El error que tengo ahora es:

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.


No lo puedo corregir, no tengo bien en claro que parametro tengo que cambiar en el servidor Apache version 2.4.6.

muchas gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 103
Oro
Ha mantenido su posición en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por xve (284 intervenciones) el 02/06/2018 13:58:48
El error Forbidden, es porque no tienes acceso para mostrar el directorio, y no tienes ninguna pagina index.html o no tienes definido cual es la pagina de inicio que tienes que buscar apache para mostrarla.

Prueba a poner en la configuración de tu VirtualHost algo como:
1
DirectoryIndex index.html index.php
Y asegúrate de que existe alguno de esos archivos en la carpeta!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 04/06/2018 17:02:07
xve, gracias por la ayuda.

Ahí edite el archivo httpd-vhosts.conf agregando el path donde esta el index.php, pero continuo con el mismo inconveniente. El archivo quedo así en estos momentos.
NameVirtualHost *:80

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<VirtualHost *:80>
 
        ServerName www.cetelem.com.ar
        #ServerName 10.24.0.168
        ServerAlias *.cetelem.com.ar
        DocumentRoot "/var/www/CetelemWeb/public"
 
        #RedirectMatch permanent ^(.*)$ https://www.cetelem.com.ar$1
 
        #no va bien:
        Redirect permanent / https://www.cetelem.com.ar/
        #Redirect permanent / https://10.24.0.168
 
        SetEnv APPLICATION_ENV "production"
        #SetEnv APPLICATION_ENV "development"
 
#RewriteEngine On
#RewriteCond %{SERVER_PORT} !443
#RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
 
        #RewriteEngine On
        #RewriteCond %{HTTP_HOST} !^www.cetelem.com.ar$ [NC]
        #RewriteCond %{HTTPS}s ^on(s)|
        #RewriteRule .* http%1://www.cetelem.com.ar$0 [R=301,L]
 
        <Directory "/var/www/CetelemWeb/public">
                DirectoryIndex index.php
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Este archivo esta aparte y yo lo apunto en el http.conf del apache. Pero continuo con el mismo errors. Es más acabo de darle permisos 777 a toda la carpeta dónde esta la pagina, pero continuo como puse con el mismo error. Cabe aclarar que además reinicie el el servicio apache para estar seguro, pero nada.

Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 103
Oro
Ha mantenido su posición en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por xve (284 intervenciones) el 04/06/2018 18:36:00
Prueba a añadir encima del "DirectoryIndex index.php":
1
Options Indexes FollowSymLinks MultiViews Includes

Comprueba que no tengas ningun archivo .htaccess en la carpeta: /var/www/CetelemWeb/public/

Coméntanos, ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 04/06/2018 18:38:14
Hola Xve, si tengo un archivo .htaccess, ése archivo no dfeberías estar ahí?

muchas gracias

Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 103
Oro
Ha mantenido su posición en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por xve (284 intervenciones) el 04/06/2018 19:05:14
Mira el contenido del archivo .htaccess... podría ser que indicara lo contrario...

Que hay en su interior?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 11
Ha aumentado 1 puesto en Apache (en relación al último mes)
Gráfica de Apache

Migracion de una web con apache v2.2 a v2.4

Publicado por jose (6 intervenciones) el 04/06/2018 19:10:15
Este es el contenido:

1
2
3
4
5
6
7
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
#RewriteRule ^.*$ index.php [NC,L]
RewriteRule !^.(homeBankARG|homeBankingARG|admonUsuarios|coreUsers|jakarta|josso)$ index.php [NC,L]


muchas gracias

Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar