nginx configuration index.html different path - nginx

I'm going crazy with the nginx configuration.
I have this directory tree
site
|-- .tmp
| +-- partials
| | |-- partial.js
| | |
| +-- serve
| +-- app
| | |-- app.css
| |
| |-- index.html
|
+-- libs
| +-- folder_a
| |
| +-- folder_b
|
+-- transpiled
| +-- app
| | |-- app.js
Also in my index.html I have the paths like
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="app/app.js"></script>
So, if I'm right, my root should be the transpiled directory.
What is a valid nginx configuration for serving my site ?
conf example added
http {
server {
location / {
root html/my_site;
index .tmp/serve/index.html;
try_files $uri transpiled/$uri;
}
}
}
I don't know nginx but i have read something about try_files.
try_files directive should search the file $uri into transpiled/$uri.
So if i have app/app.js try files should search the file in transpiled/app/app.js
This won't work

Related

Extracting a subfolder from (GNU)tar archive

What is the right spell to extract a subfolder from a tar archive when you do not know the base name?
I have a tar archive with the following structure:
myarchive.tar
|
+-- StrangeName_Including_variable_parts
|
+-- bin
| |
| +-- Uninteresting_stuff
|
+-- src
|
+-- Stuff
|
+-- I_need
My problem is to extract "src" and put it somewhere on my disk regardless of the name of base directory (StrangeName_Including_variable_parts).
I tried something like:
tar xf myarchive.tar -C destination src
But it doesn't seem to do what I need.
What I would need is:
destination
|
+-- src
|
+-- Stuff
|
+-- I_need
Extract with wildcard:
tar -xf myarchive.tar -C destination --wildcards '*/src'
See: man tar

Symfony My debug toolbar doesn't appear on my website anymore

While debugging, I actually lost my debug toolbar (like, it doesn't appear anymore on my website) so I tried various thing to have it back:
composer require symfony/profiler-pack
composer require symfony/apache-pack
And even:
composer remove apache-pack
composer require symfony/apache-pack
But I still can't have it back. I found nothing that can help on the Internet.
Thanks !
Edit:
The command bin/console debug:router _wdt return this:
| Route Name | _wdt |
| Path | /_wdt/{token} |
| Path Regex | #^/_wdt/(?P<token>[^/]++)$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | ANY |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: web_profiler.controller.profiler::toolbarAction |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler
In .env.local AND .env.dev be sure APP_ENV=dev and APP_DEBUG=1
Also, in config/packages/dev/web_profiler.yaml you have something like
web_profiler:
toolbar: true
Also, if you change any values in these you should clear your cache php bin/console cache:clear

I m installing OROCRM so i have an error during the installation process

I m installing orocrm so i have an error during the installation process
this is my command php app/console oro:install error is [Symfony\Component\Process\Exception\RuntimeException]
The process timed-out.
i have check the oro_install.log file there is no any error
here is the instrucktion page i have followed http://www.orocrm.com/documentation/index/current/book/installation
thanks
this is my console
root#efttt-Intron-5t59:/home/eures/tance/crm-application/orocrm# php app/console oro:install
Installing Oro Application.
Oro requirements check:
+---------+------------------------------------------------------------------------------------------+ | Check | Mandatory requirements
|
+---------+------------------------------------------------------------------------------------------+ | OK | Vendor libraries must be installed
| | OK | app/cache/ directory must be writable
| | OK | app/logs/ directory must be writable
| | OK | Configured default timezone "Asia/Colombo" must be
supported by your installation of PHP | | OK | json_encode() must
be available
| | OK | session_start() must be available
| | OK | ctype_alpha() must be available
| | OK | token_get_all() must be available
| | OK | simplexml_import_dom() must be available
| | OK | PCRE extension must be available
| | OK | Cache folder should not be inside encrypted directory
|
+---------+------------------------------------------------------------------------------------------+
+---------+--------------------------------------------+ | Check | PHP settings |
+---------+--------------------------------------------+ | OK | date.timezone setting must be set | | OK |
detect_unicode must be disabled in php.ini | | OK | memory_limit
should be at least 512M |
+---------+--------------------------------------------+
+---------+------------------------------------------------------------------+ | Check | Oro specific requirements
|
+---------+------------------------------------------------------------------+ | OK | PHP version must be at least 5.4.9 (5.6.11-1ubuntu3.1
installed) | | OK | GD extension must be at least 2.0
| | OK | cURL extension must be at least 7.0
| | OK | mcrypt_encrypt() should be available
| | OK | intl extension should be available
| | OK | icu library must be at least 3.8
| | OK | web/uploads/ directory must be writable
| | OK | web/media/ directory must be writable
| | OK | web/bundles/ directory must be writable
| | OK | app/attachment/ directory must be writable
| | OK | web/js directory must be writable
| | OK | web/css directory must be writable
| | OK | app/config/parameters.yml file must be writable
|
+---------+------------------------------------------------------------------+
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Check | Optional recommendations
|
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | OK | Requirements file should be up-to-date
| | OK | When using the logout handler from the Symfony Security
Component, you should have at least PHP 5.4.11 due to PHP bug #63379
(as a workaround, you can also set invalidate_session to false in the
security logout handler configuration) | | OK | PCRE extension
should be at least version 8.0 (8.35 installed)
| | OK | PHP-XML module should be installed
| | OK | mb_strlen() should be available
| | OK | iconv() should be available
| | OK | utf8_decode() should be available
| | OK | posix_isatty() should be available
| | OK | intl extension should be available
| | OK | intl extension should be correctly configured
| | OK | intl ICU version should be at least 4+
| | OK | a PHP accelerator should be installed
| | OK | short_open_tag should be disabled in php.ini
| | OK | magic_quotes_gpc should be disabled in php.ini
| | OK | register_globals should be disabled in php.ini
| | OK | session.auto_start should be disabled in php.ini
| | OK | PDO should be installed
| | OK | PDO should have some drivers installed (currently
available: dblib, mysql, odbc)
| | OK | SOAP extension should be installed (API calls)
| | OK | A JS Engine (node) is installed
|
+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Dropping database schema... Database schema dropped successfully!
Clear the entity config cache Clear the extended entity cache Setting
up database. Process migrations...
Oro\Bundle\MigrationBundle\Migration\CreateMigrationTableMigration
Oro\Bundle\OrganizationBundle\Migrations\Schema\OroOrganizationBundleInstaller
Oro\Bundle\SecurityBundle\Migrations\Schema\v1_0\OroSecurityBundle
Oro\Bundle\AttachmentBundle\Migrations\Schema\OroAttachmentBundleInstaller
Oro\Bundle\EmailBundle\Migrations\Schema\OroEmailBundleInstaller
Oro\Bundle\UserBundle\Migrations\Schema\OroUserBundleInstaller
Oro\Bundle\SSOBundle\Migrations\Schema\OroUserBundleInstaller
Oro\Bundle\EntityConfigBundle\Migrations\Schema\OroEntityConfigBundleInstaller
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_3\OroEntityConfigBundle
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_4\FixOptionSetObjects
Oro\Bundle\EntityConfigBundle\Migrations\Schema\v1_5\DropFieldConfig
Oro\Bundle\EntityExtendBundle\Migrations\Schema\OroEntityExtendBundleInstaller
Oro\Bundle\EntityExtendBundle\Migrations\Schema\v1_3\OroEntityExtendBundle
Oro\Bundle\IntegrationBundle\Migrations\Schema\OroIntegrationBundleInstaller
Oro\Bundle\ActivityBundle\Migrations\Schema\OroActivityBundleInstaller
Oro\Bundle\ActivityListBundle\Migrations\Schema\OroActivityListBundleInstaller
Oro\Bundle\AddressBundle\Migrations\Schema\OroAddressBundleInstaller
Oro\Bundle\BatchBundle\Migrations\Schema\OroBatchBundleInstaller
Oro\Bundle\CalendarBundle\Migrations\Schema\OroCalendarBundleInstaller
Oro\Bundle\CalendarBundle\Migrations\Schema\v1_9\OroCalendarBundle
Oro\Bundle\ConfigBundle\Migrations\Schema\OroConfigBundleInstaller
Oro\Bundle\CronBundle\Migrations\Schema\v1_0\OroCronBundle
Oro\Bundle\CronBundle\Migrations\Schema\v1_0\JmsJob
Oro\Bundle\CronBundle\Migrations\Schema\v1_1\JmsJob
Oro\Bundle\DataAuditBundle\Migrations\Schema\OroDataAuditBundleInstaller
Oro\Bundle\DataGridBundle\Migrations\Schema\OroDataGridBundleInstaller
Oro\Bundle\EmbeddedFormBundle\Migrations\Schema\OroEmbeddedFormBundleInstaller
Oro\Bundle\ImapBundle\Migrations\Schema\v1_0\OroImapBundle
Oro\Bundle\ImapBundle\Migrations\Schema\v1_1\OroImapBundle
Oro\Bundle\ImapBundle\Migrations\Schema\v1_2\OroImapBundle
Oro\Bundle\InstallerBundle\Migrations\Schema\OroInstallerBundle
Oro\Bundle\MigrationBundle\Migrations\Schema\v1_0\OroMigrationBundle
Oro\Bundle\MigrationBundle\Migrations\Schema\v1_1\OroMigrationBundle
Oro\Bundle\NoteBundle\Migrations\Schema\v1_0\OroNoteBundle
Oro\Bundle\NoteBundle\Migrations\Schema\v1_1\OroNoteBundle
Oro\Bundle\NotificationBundle\Migrations\Schema\OroNotificationBundleInstaller
Oro\Bundle\ReportBundle\Migrations\Schema\OroReportBundleInstaller
Oro\Bundle\SearchBundle\Migrations\Schema\OroSearchBundleInstaller
Oro\Bundle\SegmentBundle\Migrations\Schema\OroSegmentBundleInstaller
Oro\Bundle\SidebarBundle\Migrations\Schema\v1_0\OroSidebarBundle
Oro\Bundle\SidebarBundle\Migrations\Schema\v1_1\OroSidebarBundle
Oro\Bundle\TagBundle\Migrations\Schema\OroTagBundleInstaller
Oro\Bundle\TranslationBundle\Migrations\Schema\OroTranslationBundleInstaller
Oro\Bundle\WindowsBundle\Migrations\Schema\v1_0\OroWindowsBundle
Oro\Bundle\WorkflowBundle\Migrations\Schema\OroWorkflowBundleInstaller
Oro\Bundle\CommentBundle\Migrations\Schema\v1_0\OroCommentBundle
Oro\Bundle\DashboardBundle\Migrations\Schema\OroDashboardBundleInstaller
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_0\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_1\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_2\OroNavigationBundle
Oro\Bundle\NavigationBundle\Migrations\Schema\v1_3\OroNavigationBundle
OroCRM\Bundle\ContactBundle\Migrations\Schema\OroCRMContactBundleInstaller
OroCRM\Bundle\AccountBundle\Migrations\Schema\OroCRMAccountBundleInstaller
-------------------------------------------------------------------- >"Symfony\Component\Process\Exception\RuntimeException The process
timed-out."
probably due to dev log messages, try with the prod symfony env:
php app/console oro:install --env=prod
In the installation instruction on the github project page mention this note also:
Note: If the installation process times out, add the --timeout=0
argument to the command.
Hope this help

How to run BrowserMob Proxy with RobotFramework and Capture HAR files

I have written this code in robotframework
${proxy}= | Evaluate | sys.modules['selenium.webdriver'].Proxy() sys, selenium.webdriver |
${proxy.http_proxy}= | Set Variable | 127.0.0.1:8080 |
Create Webdriver | Firefox proxy=${proxy} |
Go To | http://www.knowledgefarm.in/tst/a.html |
And I am running BrowserMob proxy from command line like this:
browsermob-proxy.bat --address 127.0.0.1 --port 8080
Now, when i run robotframework, it open the browser and simple give this message on page.
HTTP ERROR: 404
Problem accessing /tst/a.html. Reason:
Not Found
Powered by Jetty://
Two questions:
why my pages are not loaded. (it works if I remove proxy setting)
After the workaround, how do I specify to generate HAR file and how should I specify the location of HAR file
The above code does not actually start a proxy. To start a proxy, you need to run these commands.
Create | http context | localhost:8080 | http
Post | /proxy
${json} | Get Response Body
${port} | Get Json Value | ${json} | /port
${proxy}= | Evaluate | sys.modules['selenium.webdriver'].Proxy() | sys,selenium.webdriver
${proxy.http_proxy}= | Set Variable | 127.0.0.1:${port}
Create Webdriver | Firefox | proxy=${proxy}
Go To | ${LOGIN URL}
Set Request Body | pageRef=LOGIN&captureContent=false&captureHeaders=true
PUT | /proxy/${port}/har
${json} | HttpLibrary.HTTP.Get Response Body
OperatingSystem.Create File | D:\\myfile.har | ${json}

Passenger/nginx not loading Sinatra app

I'm trying to run a few Sinatra apps under sub-uri's, but it seems that Passenger isn't picking them up as Rack applications.
From the nginx-error log: 403 error, directory index of "/web/archive/sites/archive/app1/" is forbidden. If I place index.html in that directory, that HTML file renders.
The apps run fine with rackup on my local machine, so I feel the application code is irrelevant. I have also SSH'd in as both the nginx user (user nginx at the top of the nginx config), and as the archive user, which is the user used to deploy all of these applications, and which owns all of the directories and files. I have no problem navigating to any of these files with either user.
Also, this setup works fine if I move it over to a subdomain, like archive.domain.com, and then have the app symlinks live right in /web/archive/sites (rather than /web/archive/sites/archive), and otherwise use pretty much the same nginx config, which is why I don't believe this is a permissions issue.
nginx config
server {
listen 80;
server_name domain.com;
location /archive {
root /web/archive/sites;
passenger_enabled on;
passenger_base_uri /app1;
passenger_base_uri /app2
}
}
directory structure
/web
|
+-- archive/
|
+-- sites/
| |
| +-- archive/
| |
| +-- app1 -> /web/archive/apps/app1/current/public
| |
| +-- app2 -> /web/archive/apps/app2/current/public
|
+-- apps/
|
+-- app1/
| |
| +-- current/
| |
| +-- public/
| |
| +-- config.ru
|
+-- app2/
|
+-- (same as app1/)
The passenger_base_uri together with the root in your configuration example do not match with the directory structure (e.g /web/archive/sites/app1 vs /web/archive/sites/archive/app1). As far as I understand Passenger does not consider the location but only root and passenger_base_uri.
Try changing the configuration into
server {
listen 80;
server_name domain.com;
location /archive {
root /web/archive/sites/archive;
passenger_enabled on;
passenger_base_uri /app1;
passenger_base_uri /app2
}
}

Resources