LINUX.ORG.RU

Поломался апач...

 ,


0

1

Колдовал со связкой nginx+apache2, но не получилось, решил снова вернуться к апачу, но он перестал корректно работать. Не хочется снова переустанавливать сервер, мож подскажете, как подлечить?
1. На роутере проброшен порт 61840->80.
2. Апач слушает 80-й порт:

netstat -tulnp | grep apache2
tcp6       0      0 :::80                   :::*                    LISTEN      12693/apache2
3.
nano /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
<IfModule ssl_module>
        Listen 443
</IfModule>
<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
4.
nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
При обращении к серверу http://myIp:61840 просто пустая страница. Изначально показывалась стандартная страница из /var/www/html. Где-то накосячил и уже голова кругом.
Куда копать?



Последнее исправление: cetjs2 (всего исправлений: 4)

Упссс...
Не работает PHP.
Т.е., при содержимом файла /var/www/html/index.php:

<?php
echo "Hi";
?>
test
отображает только «test».
Я вспомнил, что удалял apache, потом ставил снова.
Видимо, php как-то нужно подключить?

ctyz2068
() автор топика
Ответ на: комментарий от Deleted

Не подскажете, что не так с этим конфигом (делал по мануалу):

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;
root /var/www/html;

        # Add index.php to the list if you are using PHP
        #index index.html index.htm index.nginx-debian.html;
        index index.php;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
        location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
#               fastcgi_pass_unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
#
        #location ~ /\.ht {
        #       deny all;
        #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

ctyz2068
() автор топика
Ответ на: комментарий от ctyz2068

сам nginx не обрабатывает htaccess

И хвала всем богам. Вынесение части конфига в неограниченное число внешних файлов это потенциальная дыра

поэтому нужна именно связка.

Вот и связывай. Раз нормальный вариант тебе не подходит, тебе придётся самому понять, что тебе нужно и как это сделать

На nginx можно вынести раздачу статики ( картинки, css, js и т.д. ). Можно включить кэширование

Но скорее всего ты хочешь не nginx, а кэширование php кода через xcache/apc, данных через memcache

router ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.