server { servername api.lrc.tj; location /socket.io/ { clientmaxbodysize 100M; proxypass…
- User
server { server_name api.lrc.tj;
location /socket.io/ { client_max_body_size 100M; proxy_pass http://127.0.0.1:5556; } location / { client_max_body_size 100M; proxy_pass http://127.0.0.1:5555; }}
i need to replace nginx with apache2, write me config of this please
- Assistant
To replace Nginx with Apache2 and configure the given server block, you can use the following configuration:
-
Open the Apache site configuration file for your domain. For example, if your domain is "api.lrc.tj", the configuration file could be located at
/etc/apache2/sites-available/api.lrc.tj.conf. -
Replace the content of the file with the following Apache2 configuration:
<VirtualHost *:80> ServerName api.lrc.tj <Location "/socket.io/"> ProxyPass "http://127.0.0.1:5556/socket.io/" ProxyPassReverse "http://127.0.0.1:5556/socket.io/" ProxyPreserveHost On ProxyPassReverseCookieDomain 127.0.0.1 api.lrc.tj ProxyPassReverseCookiePath /socket.io/ / ProxyTimeout 300 </Location> <Location "/"> ProxyPass "http://127.0.0.1:5555/" ProxyPassReverse "http://127.0.0.1:5555/" ProxyPreserveHost On ProxyPassReverseCookieDomain 127.0.0.1 api.lrc.tj ProxyPassReverseCookiePath / / ProxyTimeout 300 </Location> </VirtualHost>-
Save and close the file.
-
Run the following command to enable the Apache site configuration:
sudo a2ensite api.lrc.tj.conf- Restart Apache to apply the changes:
sudo service apache2 restartAfter these steps, Apache should be configured to serve your site with the same logic as the previous Nginx configuration.
-
- User
Запрошенный URL не может быть получен При получении URL http://api.lrc.tj/ произошла следующая ошибка: Соединение с 94.199.18.131 не удалось
Система вернула: (111) Connection refused
Удаленный узел или сеть недоступен. Повторите запрос позднее
- Assistant
При возникновении такой ошибки "Connection refused" возможно, что приложение, на которое вы перенаправляете трафик, не работает или не запущено. В данном случае это может быть проблема с приложением на 127.0.0.1:5555 или 127.0.0.1:5556.
Убедитесь, что приложения, запущенные на этих портах, работают корректно и доступны. Если приложения запущены и доступны, проверьте, что они связаны с правильными портами и хостами в вашей конфигурации.
Также, убедитесь в том, что настроили правила фаервола (если такие имеются) для разрешения входящего трафика на указанные порты (5555 и 5556).