apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.36k stars 365 forks source link

Allow unattended install when --with-debug is given #1377

Closed BoBBer446 closed 6 years ago

BoBBer446 commented 7 years ago

I wonder why I can not download the file

I try to install but it doesn't work. i try this:

wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.12.34.2-beta.zip
unzip -qq v1.12.34.2-beta.zip

cd ngx_pagespeed-1.12.34.2-beta/

wget https://dl.google.com/dl/page-speed/psol/1.12.34.2.tar.gz
tar -xzf 1.12.34.2.tar.gz

Any idea why it doesn't work?

The complete Code (snippet) is that:

NGINX_VERSION="1.11.9"
NPS_VERSION="1.12.34.2"

# Nginx
cd ~/sources
echo "${info} Downloading Nginx Pagespeed..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}-beta.zip >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
unzip -qq v${NPS_VERSION}-beta.zip >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

echo "${info} Downloading Nginx Pagespeed psol..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
cd ngx_pagespeed-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
tar -xzf ${NPS_VERSION}.tar.gz

cd ~/sources
echo "${info} Downloading Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
tar -xzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}

echo "${info} Compiling Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--user=www-data \
--group=www-data \
--without-http_autoindex_module \
--without-http_browser_module \
--without-http_empty_gif_module \
--without-http_userid_module \
--without-http_split_clients_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-debug \
--with-pcre \
--with-cc-opt='-O2 -g -pipe -Wall -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--with-openssl=$HOME/sources/openssl-${OPENSSL_VERSION} \
--add-module=$HOME/sources/ngx_pagespeed-${NPS_VERSION}-beta >>/root/logs/make.log 2>&1

Thats work a few weeks ago but now it does not work.

BoBBer446 commented 7 years ago

If i try this:

cd ~/sources
echo "${info} Downloading Nginx Pagespeed..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}-beta.zip
unzip v${NPS_VERSION}-beta.zip

echo "${info} Downloading Nginx Pagespeed psol..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
cd ngx_pagespeed-${NPS_VERSION}-beta/

#thats cant be true
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url})  # extracts to psol/

cd ~/sources
echo "${info} Downloading Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
tar -xzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}

echo "${info} Compiling Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--user=www-data \
--group=www-data \
--without-http_autoindex_module \
--without-http_browser_module \
--without-http_empty_gif_module \
--without-http_userid_module \
--without-http_split_clients_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-debug \
--with-pcre \
--with-cc-opt='-O2 -g -pipe -Wall -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--with-openssl=$HOME/sources/openssl-${OPENSSL_VERSION} \
--add-module=$HOME/sources/ngx_pagespeed-${NPS_VERSION}-beta >>/root/logs/make.log 2>&1

# make the package
make >>/root/logs/make.log 2>&1

i get this messege:

You have set --with-debug for building nginx, but precompiled Debug binaries for
PSOL, which ngx_pagespeed depends on, aren't available.  If you're trying to
debug PSOL you need to build it from source.  If you just want to run nginx with
debug-level logging you can use the Release binaries.

Use the available Release binaries? [Y/n]

but i want an absoluty non interactive variantm, how i can fix it?

oschaaf commented 7 years ago

Instead of https://dl.google.com/dl/page-speed/psol/1.12.34.2.tar.gz (which gives a 404 response), you can use https://dl.google.com/dl/page-speed/psol/1.12.34.2-x64.tar.gz or https://dl.google.com/dl/page-speed/psol/1.12.34.2-ia32.tar.gz, depending on bitness.

It may also be good to read https://modpagespeed.com/doc/build_ngx_pagespeed_from_source to see if the new automated install script can help your purpose. That also has a flag (-y) for a non-interactive install.

BoBBer446 commented 7 years ago

Okay, thank you.

But if i use it i get this messege again:

You have set --with-debug for building nginx, but precompiled Debug binaries for
PSOL, which ngx_pagespeed depends on, aren't available.  If you're trying to
debug PSOL you need to build it from source.  If you just want to run nginx with
debug-level logging you can use the Release binaries.

Use the available Release binaries? [Y/n]

I never bevore become this messege

i try to delete "--with-debug" but i cant use the automatic installer for now

oschaaf commented 7 years ago

Is see. I looked into that, currently there's no way to avoid that, sorry. (unless you leave out --debug)

BoBBer446 commented 7 years ago

I'm not the professional I want to be. I'm just trying to get the script to run: https://github.com/shoujii/perfectrootserver

I have something done but I get nginx no longer installed. Maybe someone has an idea or a tip for me.

The entire script for nginx installation looks like this:

nginx() {

# Nginx
cd ~/sources
echo "${info} Downloading Nginx Pagespeed..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}-beta.zip >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
unzip v${NPS_VERSION}-beta.zip >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

echo "${info} Downloading Nginx Pagespeed psol..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
cd ngx_pagespeed-${NPS_VERSION}-beta/ >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

#Todo: fix choice

    #x64
    wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}-x64.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    tar -xzf ${NPS_VERSION}-x64.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

    #x32
    #wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}-ia32.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    #tar -xzf ${NPS_VERSION}-ia32.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

cd ~/sources
echo "${info} Downloading Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
tar -xzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}

echo "${info} Compiling Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--user=www-data \
--group=www-data \
--without-http_autoindex_module \
--without-http_browser_module \
--without-http_empty_gif_module \
--without-http_userid_module \
--without-http_split_clients_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-pcre \
--with-cc-opt='-O2 -g -pipe -Wall -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--with-openssl=$HOME/sources/openssl-${OPENSSL_VERSION} \
--add-module=$HOME/sources/ngx_pagespeed-${NPS_VERSION}-beta >>/root/logs/make.log 2>&1

#habe "--with-debug \" erstmal raus genommen. Gibt Probleme
#
# You have set --with-debug for building nginx, but precompiled Debug binaries for
# PSOL, which ngx_pagespeed depends on, aren't available.  If you're trying to
# debug PSOL you need to build it from source.  If you just want to run nginx with
# debug-level logging you can use the Release binaries.
#
# Use the available Release binaries? [Y/n]
#
# ToDo: Autimatic installer maybe....

# make the package
make >>/root/logs/make.log 2>&1

# Create a .deb package
checkinstall --install=no -y >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

# Install the package
echo "${info} Installing Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
dpkg -i nginx_${NGINX_VERSION}-1_amd64.deb >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
mv nginx_${NGINX_VERSION}-1_amd64.deb ../

# Create directories
mkdir -p /var/lib/nginx/body && cd $_
mkdir ../proxy
mkdir ../fastcgi
mkdir ../uwsgi
mkdir ../cgi
mkdir ../nps_cache
mkdir /var/log/nginx
mkdir /etc/nginx/sites-available && cd $_
mkdir ../sites-enabled
mkdir ../sites-custom
mkdir ../htpasswd
touch ../htpasswd/.htpasswd
mkdir ../logs
mkdir ../ssl
chown -R www-data:www-data /var/lib/nginx
chown www-data:www-data /etc/nginx/logs

# Install the Nginx service script
wget -O /etc/init.d/nginx --no-check-certificate https://raw.githubusercontent.com/Fleshgrinder/nginx-sysvinit-script/master/init >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
chmod 0755 /etc/init.d/nginx
chown root:root /etc/init.d/nginx
update-rc.d nginx defaults

# Edit/create Nginx config files
echo "${info} Configuring Nginx..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'

rm -rf /etc/nginx/nginx.conf
cat > /etc/nginx/nginx.conf <<END
user www-data;
worker_processes auto;
pid /var/run/nginx.pid;
events {
    worker_connections  4024;
    multi_accept on;
    use epoll;
}
http {
        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;
        server_tokens       off;
        keepalive_timeout   70;
        sendfile            on;
        send_timeout 60;
        tcp_nopush on;
        tcp_nodelay on;
        client_max_body_size 50m;
        client_body_timeout 15;
        client_header_timeout 15;
        client_body_buffer_size 1K;
        client_header_buffer_size 1k;
        large_client_header_buffers 4 8k;
        reset_timedout_connection on;
        server_names_hash_bucket_size 100;
        types_hash_max_size 2048;
        open_file_cache max=2000 inactive=20s;
        open_file_cache_valid 60s;
        open_file_cache_min_uses 5;
        open_file_cache_errors off;
        gzip on;
        gzip_static on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 16 8k;https://web.whatsapp.com/
        gzip_http_version 1.1;
        gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
        log_format main     '\$remote_addr - \$remote_user [\$time_local] "\$request" '
                            '\$status \$body_bytes_sent "\$http_referer" '
                            '"\$http_user_agent" "\$http_x_forwarded_for"';
        access_log      logs/access.log main buffer=16k;
        error_log           logs/error.log;
        map \$http_referer \$bad_referer {
            default 0;
            ~(?i)(adult|babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|webcam|zippo|casino|replica) 1;
        }
        map \$http_cookie \$cache_uid {
          default nil;
          ~SESS[[:alnum:]]+=(?<session_id>[[:alnum:]]+) \$session_id;
        }

        map \$request_method \$no_cache {
          default 1;
          HEAD 0;
        }
        include         /etc/nginx/sites-enabled/*.conf;
}
END

# SSL certificate
if [ ${CLOUDFLARE} == '0' ] && [ ${USE_VALID_SSL} == '1' ]; then
    echo "${info} Creating valid SSL certificates..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
    git clone https://github.com/letsencrypt/letsencrypt ~/sources/letsencrypt -q
    cd ~/sources/letsencrypt
    if [ ${USE_MAILSERVER} == '1' ]; then
        ./letsencrypt-auto --agree-tos --renew-by-default --non-interactive --standalone --email ${SSLMAIL} --rsa-key-size ${RSA_KEY_SIZE} -d ${MYDOMAIN} -d www.${MYDOMAIN} -d mail.${MYDOMAIN} -d autodiscover.${MYDOMAIN} -d autoconfig.${MYDOMAIN} -d dav.${MYDOMAIN} certonly >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    else
        ./letsencrypt-auto --agree-tos --renew-by-default --non-interactive --standalone --email ${SSLMAIL} --rsa-key-size ${RSA_KEY_SIZE} -d ${MYDOMAIN} -d www.${MYDOMAIN} certonly >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    fi
    ln -s /etc/letsencrypt/live/${MYDOMAIN}/fullchain.pem /etc/nginx/ssl/${MYDOMAIN}.pem
    ln -s /etc/letsencrypt/live/${MYDOMAIN}/privkey.pem /etc/nginx/ssl/${MYDOMAIN}.key.pem
else
    echo "${info} Creating self-signed SSL certificates..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
    openssl ecparam -genkey -name secp384r1 -out /etc/nginx/ssl/${MYDOMAIN}.key.pem >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    openssl req -new -sha256 -key /etc/nginx/ssl/${MYDOMAIN}.key.pem -out /etc/nginx/ssl/csr.pem -subj "/C=DE/ST=Private/L=Private/O=Private/OU=Private/CN=*.${MYDOMAIN}" >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
    openssl req -x509 -days 365 -key /etc/nginx/ssl/${MYDOMAIN}.key.pem -in /etc/nginx/ssl/csr.pem -out /etc/nginx/ssl/${MYDOMAIN}.pem -subj "/C=DE/ST=Private/L=Private/O=Private/OU=Private/CN=*.${MYDOMAIN}" >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log
fi

HPKP1=$(openssl x509 -pubkey < /etc/nginx/ssl/${MYDOMAIN}.pem | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64)
HPKP2=$(openssl rand -base64 32)

echo "${info} Creating strong Diffie-Hellman parameters, please wait..." | awk '{ print strftime("[%H:%M:%S] |"), $0 }'
openssl dhparam -out /etc/nginx/ssl/dh.pem ${RSA_KEY_SIZE} >>/root/logs/stderror.log 2>&1 >>/root/logs/stdout.log

# Create server config
rm -rf /etc/nginx/sites-available/${MYDOMAIN}.conf
cat > /etc/nginx/sites-available/${MYDOMAIN}.conf <<END
server {
            listen              80 default_server;
            server_name         ${IPADR} ${MYDOMAIN};
            return 301          https://${MYDOMAIN}\$request_uri;
}
server {
            listen              443;
            server_name         ${IPADR} www.${MYDOMAIN} mail.${MYDOMAIN};
            return 301          https://${MYDOMAIN}\$request_uri;
}
server {
            listen              443 ssl http2 default deferred;
            server_name         ${MYDOMAIN};
            root                /etc/nginx/html;
            index               index.php index.html index.htm;
            charset             utf-8;
            error_page 404      /index.php;https://web.whatsapp.com/
            ssl_certificate     ssl/${MYDOMAIN}.pem;
            ssl_certificate_key ssl/${MYDOMAIN}.key.pem;
            #ssl_trusted_certificate ssl/${MYDOMAIN}.pem;
            ssl_dhparam         ssl/dh.pem;
            ssl_ecdh_curve      secp384r1;
            ssl_session_cache   shared:SSL:10m;
            ssl_session_timeout 10m;
            ssl_session_tickets off;
            ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
            ssl_prefer_server_ciphers on;
            ssl_buffer_size     1400;
            #ssl_stapling       on;
            #ssl_stapling_verify on;
            #resolver           8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
            #resolver_timeout   2s;
            ssl_ciphers         "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK";
            #add_header         Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
            ##add_header        Public-Key-Pins 'pin-sha256="PIN1"; pin-sha256="PIN2"; max-age=5184000; includeSubDomains';
            add_header          Cache-Control "public";
            add_header          X-Frame-Options SAMEORIGIN;
            add_header          Alternate-Protocol  443:npn-http/2;
            add_header          X-Content-Type-Options nosniff;
            add_header          X-XSS-Protection "1; mode=block";
            add_header          X-Permitted-Cross-Domain-Policies "master-only";
            add_header          "X-UA-Compatible" "IE=Edge";
            add_header          "Access-Control-Allow-Origin" "*";
            add_header          Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *.youtube.com maps.gstatic.com *.googleapis.com *.google-analytics.com cdnjs.cloudflare.com assets.zendesk.com connect.facebook.net; frame-src 'self' *.youtube.com assets.zendesk.com *.facebook.com s-static.ak.facebook.com tautt.zendesk.com; object-src 'self'";
            pagespeed           on;
            pagespeed           EnableFilters collapse_whitespace;
            pagespeed           EnableFilters canonicalize_javascript_libraries;
            pagespeed           EnableFilters combine_css;
            pagespeed           EnableFilters combine_javascript;
            pagespeed           EnableFilters elide_attributes;
            pagespeed           EnableFilters extend_cache;
            pagespeed           EnableFilters flatten_css_imports;
            pagespeed           EnableFilters lazyload_images;
            pagespeed           EnableFilters rewrite_javascript;
            pagespeed           EnableFilters rewrite_images;
            pagespeed           EnableFilters insert_dns_prefetch;
            pagespeed           EnableFilters prioritize_critical_css;
            pagespeed           FetchHttps enable,allow_self_signed;
            pagespeed           FileCachePath /var/lib/nginx/nps_cache;
            pagespeed           RewriteLevel CoreFilters;
            pagespeed           CssFlattenMaxBytes 5120;
            pagespeed           LogDir /var/log/pagespeed;
            pagespeed           EnableCachePurge on;
            pagespeed           PurgeMethod PURGE;
            pagespeed           DownstreamCachePurgeMethod PURGE;
            pagespeed           DownstreamCachePurgeLocationPrefix http://127.0.0.1:80/;
            pagespeed           DownstreamCacheRewrittenPercentageThreshold 95;
            pagespeed           LazyloadImagesAfterOnload on;
            pagespeed           LazyloadImagesBlankUrl "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
            pagespeed           MemcachedThreads 1;
            pagespeed           MemcachedServers "localhost:11211";
            pagespeed           MemcachedTimeoutUs 100000;
            pagespeed           RespectVary on;
            pagespeed           Disallow "*/pma/*";
            # This will correctly rewrite your subresources with https:// URLs and thus avoid mixed content warnings.
            # Note, that you should only enable this option if you are behind a load-balancer that will set this header,
            # otherwise your users will be able to set the protocol PageSpeed uses to interpret the request.
            #
            #pagespeed          RespectXForwardedProto on;
            auth_basic_user_file htpasswd/.htpasswd;
            location ~ \.php\$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)\$;
                if (!-e \$document_root\$fastcgi_script_name) {
                    return 404;
                }
                try_files \$fastcgi_script_name =404;
                fastcgi_param PATH_INFO \$fastcgi_path_info;
                fastcgi_param PATH_TRANSLATED \$document_root\$fastcgi_path_info;
                fastcgi_param APP_ENV production;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                fastcgi_intercept_errors off;
                fastcgi_ignore_client_abort off;
                fastcgi_buffers 256 16k;
                fastcgi_buffer_size 128k;
                fastcgi_connect_timeout 3s;
                fastcgi_send_timeout 120s;
                fastcgi_read_timeout 120s;
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;
            }
            include /etc/nginx/sites-custom/*.conf;
            location / {
                # Uncomment, if you need to remove index.php from the
                # URL. Usefull if you use Codeigniter, Zendframework, etc.
                # or just need to remove the index.php
                #
                #try_files \$uri \$uri/ /index.php?\$args;
            }
            location ~* /\.(?!well-known\/) {
                deny all;
                access_log off;
                log_not_found off;
            }
            location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
                deny all;
                access_log off;
                log_not_found off;
            }
            location = /favicon.ico {
                access_log off;
                log_not_found off;
            }

            location = /robots.txt {
                allow all;
                access_log off;
                log_not_found off;
            }
            location ~* ^.+\.(css|js)\$ {
                rewrite ^(.+)\.(\d+)\.(css|js)\$ \$1.\$3 last;
                expires 30d;
                access_log off;
                log_not_found off;
                add_header Pragma public;
                add_header Cache-Control "max-age=2592000, public";
            }
            location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)\$ {
                expires 30d;
                access_log off;
                log_not_found off;
                add_header Pragma public;
                add_header Cache-Control "max-age=2592000, public";
            }
            if (\$http_user_agent ~* "FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|Scrapy") {
                return 403;
            }
}
END

ln -s /etc/nginx/sites-available/${MYDOMAIN}.conf /etc/nginx/sites-enabled/${MYDOMAIN}.conf

if [ ${CLOUDFLARE} == '0' ] && [ ${USE_VALID_SSL} == '1' ]; then
    sed -i 's/#ssl/ssl/g' /etc/nginx/sites-available/${MYDOMAIN}.conf
    sed -i 's/#resolver/resolver/g' /etc/nginx/sites-available/${MYDOMAIN}.conf
    sed -i 's/#add/add/g' /etc/nginx/sites-available/${MYDOMAIN}.conf
fi

# Restart Nginx
systemctl -q start nginx.service

}
source ~/configs/userconfig.cfg
source ~/configs/versions.cfg
temoto commented 7 years ago

echo y| ./configure ... clutch helps.

comel commented 7 years ago

@oschaaf What if the Building Release Binaries is followed and Debug build included in the psol binary release as in previous releases?

oschaaf commented 7 years ago

@comel The release process is described over at https://github.com/pagespeed/mod_pagespeed/wiki/Release-Process.

I think that the reason for not including the debug version of pagespeed_automatic.a was that most people don't need it, and it is quite large in size.

The latest stable does offer an environment variable for pointing ngx_pagespeed to the pagespeed_automatic.a that you want it to link (PSOL_BINARY): https://github.com/pagespeed/ngx_pagespeed/blob/34/config#L17

I think you could point it to the release version if running a debug version of pagespeed_automatic.a is not the reason that you are passing in --with-debug, and doing so should bypass the Use the available Release binaries? [Y/n] confirmation.

If you do need the debug version of pagespeed_automatic.a, this should get you one for the latest stable:

mkdir ~/mpstmp && \
cd ~/mpstmp && \
git clone -b latest-stable --recursive https://github.com/pagespeed/mod_pagespeed.git . && \
python build/gyp_chromium --depth=. && \
cd pagespeed/automatic && \
make all BUILDTYPE=Debug && \
ls -lh | grep pagespeed_automatic.a
cryptofuture commented 6 years ago

Please make pagespeed_automatic.a available for download too, building takes quite a while (30 minutes, still building)

oschaaf commented 6 years ago

@cryptofuture Unfortunately I do not think anyone currently is looking into making the debug version of pagespeed_automatic.a available for download, and it isn't on the priority list either.

Closing this issue as the initial request has been resolved. You could file an new issue to request this, if it gets a lot of traction it may bubble up on the priority list: https://github.com/pagespeed/mod_pagespeed/wiki/Work-Prioritization

ygm521 commented 5 years ago

@oschaaf Our goal is not to debug pagespeed, but to enable nginx --with-debug, but it can't be compiled successfully.

ygm521 commented 5 years ago

i get this messege:

You have set --with-debug for building nginx, but precompiled Debug binaries for PSOL, which ngx_pagespeed depends on, aren't available. If you're trying to debug PSOL you need to build it from source. If you just want to run nginx with debug-level logging you can use the Release binaries.

Use the available Release binaries? [Y/n]

ygm521 commented 5 years ago

@oschaaf Cloning into 'third_party/apr/src'... fatal: unable to connect to git.apache.org: git.apache.org[0: 52.202.80.70]: errno=Connection timed out

Lofesa commented 5 years ago

Hi @ygm521 See #1666

ygm521 commented 5 years ago

@Lofesa Our goal is not to debug pagespeed, but to enable nginx --with-debug, but it can't be compiled successfully.What are the steps to solve this problem? Can you elaborate on which commands need to be executed? thank you!

Lofesa commented 5 years ago

@ygm521

I´m not sure, cause I have not used the debug, but I think that if you try to compile nginx --with-debug and the pagespeed module is here (in fact any module you have set), the pagespeed module tries to compile --with-debug too. If you have only nginx w/o pagespeed module. are you able to compile --with-debug?

ygm521 commented 5 years ago

nginx --with-debug has nothing with pagespeed,why limited?

Lofesa commented 5 years ago

As far as you have set ANY modules with nginx, if you set --with-debug, I think this flag is pased to all the modules, not only to pagespeed module.

A workaouround maybe: 1.- copile nginx --with-debug w/o ANY modules 2.- compile nginx with the modules but with the exact same settings that in 1 except --with-debug 3.- use the nginx exec from 1 and the modules files from 2

This workaround is for dinamyc modules, if you are using static ones, I think you have no chance, the modules need to be compiled with --with-debug too.

And again: If you have only nginx w/o pagespeed module. are you able to compile --with-debug?

ygm521 commented 5 years ago

Currently, only the pagespeed module in the modules I have seen ,restricts the use of --with-debug when Nginx is compiled.What a stupid idea! Nginx can't use --with-debug when compiling, so how do the debug logs of other modules output? Say again, so stupid !

oschaaf commented 5 years ago

@ygm521 Looking at https://github.com/apache/incubator-pagespeed-ngx/blob/master/config#L18 I wonder: What would happen when you set PSOL_BUILDTYPE=Release while passing --with-debug to configure?

ygm521 commented 5 years ago

@oschaaf I don't want to use pagespeed_automatic.a , How did i use the source code to compile and generate pagespeed_automatic.a? The following operation is correct? mkdir ~/mpstmp cd ~/mpstmp git clone -b latest-stable --recursive https://github.com/pagespeed/mod_pagespeed.git

python build/gyp_chromium --depth=.
cd pagespeed/automatic
make all BUILDTYPE=Debug
ls -lh | grep pagespeed_automatic.a
ygm521 commented 5 years ago

@oschaaf In fact, your method is good, I used to do this before.