Hello!
My server OS ubuntu-server 17.10 and i use apache and have systemd. My project https://github.com/sinitcin/sci_questionnaire.
And systemd config for question.service:
$ cat /etc/systemd/system/question.service
[Unit]
Description=Question server
[Service]
Type=simple
Environment=ROCKET_ADDRESS="0.0.0.0"
ExecStart=/var/www/que/sci_questionnaire
WorkingDirectory=/var/www/que/
TimeoutSec=10
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Apache config:
$ cat /etc/apache2/sites-available/que.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName question.xn--h1aaobq7a9a.xn--p1acf
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests On
ProxyVia On
ProxyPass / http://0.0.0.0:8000 timeout=600
ProxyPassReverse / http://0.0.0.0:8000 timeout=600
</VirtualHost>
I see index.html, but if I send the GET http: //question.xn--h1aaobq7a9a.xn--p1acf/jqplot/jquery.jqplot.js, I'll get the response:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /jqplot/jquery.jqplot.js.
Reason: DNS lookup failure for: 0.0.0.0:8000jqplot
Apache/2.4.27 (Ubuntu) Server at question.xn--h1aaobq7a9a.xn--p1acf Port 80
Please help me for fix this error =(
ProxyPass / http://0.0.0.0:8000 timeout=600
ProxyPassReverse / http://0.0.0.0:8000 timeout=600
There is a slash missing. It should be http://0.0.0.0:8000/. Otherwise the rest of the url will be appended like this http://0.0.0.0:8000jqplot/jquery.jqplot.js
Oh... It's works, thanks.
But i have are new problem, server slowly work =(
Screen - https://cloud.xn--h1aaobq7a9a.xn--p1acf/index.php/s/kPJsKTRg2yqFfbS
File download over 10 sec, but why? File size 22 kb.
Honestly, you shouldn't use rocket to serve static files at the moment. The current thread implementation is only able to handle one request per thread or in other words, 4 threads can only transfer 4 files at a time. There is ongoing work about that but it might take a while.
My advice is to use the apache for everything static like javascript and CSS. You can add a location for something like /media containing those files. In the HTML, you can reference those files under the new location. apache will deal with all the static files and rocket can handle the dynamic part.
And you can show it on my apache configuration. I do not really understand how I can combine proxypass and a directory with static files? I'm very glad that you helped me, thanks
I won't walk you through. But this link should give you all the information you need. Just modify it to your situation:
You best of the best =) Thank! My project began to look much better =)