Various improvements

pull/335/head
Rad0van 4 years ago
parent a1e0c8c80c
commit f7b5bdb4a6

@ -49,8 +49,8 @@ ADMIN_EMAIL="odoo@example.com"
## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ): ## https://github.com/odoo/odoo/wiki/Wkhtmltopdf ):
## https://www.odoo.com/documentation/13.0/setup/install.html#debian-ubuntu ## https://www.odoo.com/documentation/13.0/setup/install.html#debian-ubuntu
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_amd64.deb WKHTMLTOX_X64=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.(lsb_release -c -s)_amd64.deb
WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.trusty_i386.deb WKHTMLTOX_X32=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.(lsb_release -c -s)_i386.deb
#-------------------------------------------------- #--------------------------------------------------
# Update Server # Update Server
#-------------------------------------------------- #--------------------------------------------------
@ -268,7 +268,7 @@ if [ $INSTALL_NGINX = "True" ]; then
echo -e "\n---- Installing and setting up Nginx ----" echo -e "\n---- Installing and setting up Nginx ----"
sudo apt install nginx -y sudo apt install nginx -y
cat <<EOF > ~/odoo cat <<EOF > ~/odoo
server { server {
listen 80; listen 80;
# set proper server name after domain set # set proper server name after domain set
@ -324,11 +324,13 @@ if [ $INSTALL_NGINX = "True" ]; then
location /longpolling { location /longpolling {
proxy_pass http://127.0.0.1:$LONGPOLLING_PORT; proxy_pass http://127.0.0.1:$LONGPOLLING_PORT;
} }
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ { location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires 2d; expires 2d;
proxy_pass http://127.0.0.1:$OE_PORT; proxy_pass http://127.0.0.1:$OE_PORT;
add_header Cache-Control "public, no-transform"; add_header Cache-Control "public, no-transform";
} }
# cache some static data in memory for 60mins. # cache some static data in memory for 60mins.
location ~ /[a-zA-Z0-9_-]*/static/ { location ~ /[a-zA-Z0-9_-]*/static/ {
proxy_cache_valid 200 302 60m; proxy_cache_valid 200 302 60m;
@ -337,15 +339,15 @@ if [ $INSTALL_NGINX = "True" ]; then
expires 864000; expires 864000;
proxy_pass http://127.0.0.1:$OE_PORT; proxy_pass http://127.0.0.1:$OE_PORT;
} }
} }
EOF EOF
sudo mv ~/odoo /etc/nginx/sites-available/ sudo mv ~/odoo /etc/nginx/sites-available/$WEBSITE_NAME
sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo sudo ln -s /etc/nginx/sites-available/$WEBSITE_NAME /etc/nginx/sites-enabled/$WEBSITE_NAME
sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-enabled/default
sudo service nginx reload sudo service nginx reload
sudo su root -c "printf 'proxy_mode = True\n' >> /etc/${OE_CONFIG}.conf" sudo su root -c "printf 'proxy_mode = True\n' >> /etc/${OE_CONFIG}.conf"
echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-available/odoo" echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-available/$WEBSITE_NAME"
else else
echo "Nginx isn't installed due to choice of the user!" echo "Nginx isn't installed due to choice of the user!"
fi fi
@ -380,6 +382,6 @@ echo "Start Odoo service: sudo service $OE_CONFIG start"
echo "Stop Odoo service: sudo service $OE_CONFIG stop" echo "Stop Odoo service: sudo service $OE_CONFIG stop"
echo "Restart Odoo service: sudo service $OE_CONFIG restart" echo "Restart Odoo service: sudo service $OE_CONFIG restart"
if [ $INSTALL_NGINX = "True" ]; then if [ $INSTALL_NGINX = "True" ]; then
echo "Nginx configuration file: /etc/nginx/sites-available/odoo" echo "Nginx configuration file: /etc/nginx/sites-available/$WEBSITE_NAME"
fi fi
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"

Loading…
Cancel
Save